标签:字符串
The National Intelligence Council of X Nation receives a piece of credible information that Nation Y will send spies to steal Nation X’sconfidential paper. So the commander of The National Intelligence Council take measures immediately, he will investigate people who will come into NationX. At the same time, there are two List in the Commander’s hand, one is full of spies that Nation Y will send to Nation X, and the other one is full of spies that Nation X has sent to Nation Y before. There may be some overlaps of the two list. Because the spy may act two roles at the same time, which means that he may be the one that is sent from Nation X to Nation Y, we just call this type a “dual-spy”. So Nation Y may send “dual_spy” back to Nation X, and it is obvious now that it is good for Nation X, because “dual_spy” may bring back NationY’s confidential paper without worrying to be detention by NationY’s frontier So the commander decides to seize those that are sent by NationY, and let the ordinary people and the “dual_spy” in at the same time .So can you decide a list that should be caught by the Commander?
A:the list contains that will come to the NationX’s frontier.
B:the list contains spies that will be sent by Nation Y.
C:the list contains spies that were sent to NationY before.
8 4 3 Zhao Qian Sun Li Zhou Wu Zheng Wang Zhao Qian Sun Li Zhao Zhou Zheng 2 2 2 Zhao Qian Zhao Qian Zhao Qian
Qian Sun Li No enemy spy
无
辽宁省赛2010
#include <algorithm> #include <iostream> #include <cstring> #include <cstdio> using namespace std; const int mx = 1e3 + 5; int a,b,c; char pe[mx][20],spy[mx][20],dpy[mx][20]; int main() { while(~scanf("%d%d%d",&a,&b,&c)) { for(int i=0; i<a; i++) { scanf("%s",pe[i]); } for(int i=0; i<b; i++) { scanf("%s",spy[i]); } for(int i=0; i<c; i++) { scanf("%s",dpy[i]); for(int j=0; j<a; j++) if(strcmp(dpy[i],pe[j])==0) { strcpy(pe[j],"***"); // printf("[%d,%d] ",i,j); break; } } int cnt=0; for(int i=0; i<b; i++) { for(int j=0; j<a; j++) if(strcmp(spy[i],pe[j])==0) { cnt++; if(cnt==1) printf("%s",spy[i]); else printf(" %s",spy[i]); continue; } } if(!cnt) printf("No enemy spy"); puts(""); // for(int i=0; i<a; i++) // puts(pe[i]); } return 0; }
RunID
|
User
|
Problem
|
Result
|
Memory
(KB) |
Time
(ms) |
Language
|
Length
(Bytes) |
|
---|---|---|---|---|---|---|---|---|
4441548 | ZXPxx | D | 280 | 0 | 1190 | |||
4441510 | ZXPxx | D | 1149 | |||||
4440963 | ZXPxx | D | 1094 | |||||
4440913 | ZXPxx | D | 1088 | |||||
4440905 | ZXPxx | D | 1070 |
版权声明:本文为博主原创文章,未经博主允许不得转载。
标签:字符串
原文地址:http://blog.csdn.net/zhang_xueping/article/details/47756953