c语言编程练习题:7-161 帅到没朋友
作者:yunjinqi   类别:    日期:2023-05-31 18:06:43    阅读:465 次   消耗积分:0 分    

image.png

#include <stdio.h>
#include <string.h>
int main(){
    int n,k,v,m;
    int arr[100000]={0};
    if (scanf("%d",&n)!=EOF){
        // 读取数据
        for (int i=0;i<n;i++){
            if (scanf("%d",&k)!=EOF){
                for (int j=0;j<k;j++){
                    if (scanf("%d",&v)!=EOF){
                        if (k!=1){arr[v]++;}
                        
                    }
                }
            }
        }
        // 查询
        int  count=0;
        if (scanf("%d",&m)!=EOF){
            for (int i=0;i<m;i++){
                // 查找这个人是否没有朋友圈
                if (scanf("%d",&v)!=EOF){
                       if (arr[v]==0){
                            if (count!=0){
                                printf(" ");
                            }
                            printf("%05d",v);//注意题目指明为五位数字;
                            count++;
                            arr[v]++;
                                            
                            }
                        }
            }
        }
        // 打印
        if (count==0){
            printf("No one is handsome");
        }
        
    }
    return 0;
}


版权所有,转载本站文章请注明出处:云子量化, http://www.woniunote.com/article/286
上一篇:c语言编程练习题:7-160 跟奥巴马一起画方块
下一篇:c语言编程练习题:7-162 检查密码