Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
超时了,哪位过来看一下啊#include<iostream> #include<string> using namespace std; int main() { int i=0,j,n,flag; char c[100]; string a[100009],b[100009]; while(1) { i++; gets(c); if(c[0]=='\0') break; a[i]=c; for(j=0;j<=a[i].length();j++) if(a[i][j]==' ') { b[i]=a[i].substr(j+1); a[i]=a[i].substr(0,j); break; } } n=i-1; while(scanf("%s",c)!=EOF) { flag=0; for(j=1;j<=n;j++) { //cout<<c; if(b[j]==c) { flag=1; printf("%s\n",&a[j][0]); break; } } if(flag==0) printf("eh\n"); } return 0; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator