您的位置:首页 > 其它

【9018p1316】SPY(辽宁省赛2010)

2014-03-21 17:38 246 查看
http://218.5.5.242:9018/JudgeOnline/problem.php?id=1316

#include<cstdio>
#include<cstring>
#include<iostream>
#include<string>
using namespace std;
int a,b,c;
string sa[1005],sb[1005],sc[1005];
bool checka(int x){
for(int i=0;i<a;i++)
if(sa[i]==sb[x])return 1;
return 0;
}
bool checkc(int x){
for(int i=0;i<c;i++)
if(sc[i]==sb[x])return 1;
return 0;
}
int main(){
while(scanf("%d%d%d",&a,&b,&c)!=EOF){
bool first=1;
for(int i=0;i<a;i++)cin>>sa[i];
for(int i=0;i<b;i++)cin>>sb[i];
for(int i=0;i<c;i++)cin>>sc[i];
for (int i = 0; i < b; i++){
if(checka(i) && !checkc(i)){
if (!first)cout << ' ';
else first = 0;
cout << sb[i];
}
}
if (!first)cout << endl;
else cout << "No enemy spy" << endl;
}
return 0;
}
/**************************************************************
Problem: 1316
User: ndsf
Language: C++
Result: 正确
Time:0 ms
Memory:1496 kb
****************************************************************/
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: