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]; Node dir[MAX]; int main() { char c; int mark=-1; int i,j; char ss[40]; while(gets(ss)&&ss[0]!='\0') { sscanf(ss,"%s%s",&dir[mark].en ,&dir[mark].fo); int len=strlen(dir[mark].fo); int sum=0; for(i=0;i<len;i++) sum+=(dir[mark].fo[i]-'a'); strcpy(dic[sum].en,dir[mark].en); strcpy(dic[sum].fo,dir[mark].fo); } 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