您的位置:首页 > 其它

1072. 开学寄语(20)

2017-10-15 17:06 288 查看
// 2017/10/14 NCU
// PAT-B 1072
// scienceZ
#include <cstdio>
#include <set>
#include <cstring>
#include <iostream>
using namespace std;

int bi[10000];
char str[10];

int n, m, men, item;

int main()
{
cin >> n >> m;
for (int i = 0; i < m; i++){
int j;
cin >> j;
bi[j] = 1;
}
for (int i = 0; i < n; i++){

cin >> str;

int z = 0, key = 1;
cin >> z;

for (int j = 0; j < z; j++){

int t;
cin >> t;
if(bi[t]){
if (key){
printf("%s:", str);
key = 0;
}
printf(" %04d", t);
item++;
}
}
if(!key) { cout << endl; men++; }
}

printf("%d %d", men, item);
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: