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<cstdio> #include<cstring> #include<cmath> #include<cstdlib> #include<algorithm> #define MAX 100010 using namespace std; struct Node { char en[12]; char fo[12]; }; Node dic[MAX*100]; int main() { char c; char qq[40],ww[40]; int mark=0; int i,j; char ss[40]; while(gets(ss)&&ss[0]!='\0') { sscanf(ss,"%s %s",&qq,&ww); int len=strlen(ww); int sum=0; for(i=0;i<len;i++) sum+=(ww[i]-'a'); strcpy(dic[sum].en,qq); strcpy(dic[sum].fo,ww); } char str[20]; while(scanf("%s",str)!=EOF) { int len=strlen(str); int sum=0,i; bool flag=0; for(i=0;i<len;i++) sum+=(str[i]-'a'); if(!strcmp(str,dic[sum].fo)) { puts(dic[sum].en); flag=1; } if(!flag) 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