开学寄语
作者:互联网
题源
题解
#include<stdio.h>
#include<string.h>
int N,M,n;
int flag = 0;
int student = 0,object = 0;
char key[6][5];
char own[5];
char name[5];
int main(){
scanf("%d %d",&N,&M);
int i = 0,j = 0;
for(i = 0;i < M;i++)scanf("%s",&key[i]);
for(i = 0;i < N;i++){
scanf("%s %d",&name,&n);
for(flag = 0;n--;){
scanf("%s",&own);
for(j = 0;j < M;j++){
if(strcmp(own,key[j])==0){
if(flag==0){
printf("%s:",name);
student++;flag++;
}
printf(" %s",own);
object++;
}
}
}if(flag!=0)printf("\n");
}
printf("%d %d\n",student,object);
getchar();getchar();
return 0;
}
标签:寄语,开学,++,scanf,int,flag,own,printf 来源: https://blog.csdn.net/Fake_God/article/details/116266593