1. PTA-帅到没朋友
代码
#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 7;
int a[N];
int main()
{
int n, m;
cin >> n;
memset(a, 0, sizeof(a));
int x;
while(n --)
{
cin >> m;
if(m == 1) cin >> x;
else
{
while(m --)
{
cin >> x;
a[x] = 1;
}
}
}
cin >> n;
int t = 0;
while(n --)
{
cin >> m;
if(a[m] == 0)
{
a[m] = 1;
if(t == 0)
{
printf("%05d", m);
}
else printf(" %05d", m);
t ++;
}
}
if(t == 0) printf("No one is handsome\n");
return 0;
}
遇到计数题可以用标记法