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 |
WA了N+次,求助...//WA CODE #include<cstdio> #include<string> int n,m,s[1001]; char dict[1001][17],desc[10000000]; int main() { scanf("%d%d",&m,&n); int i,j; for(i=0;i<m;i++) scanf("%s%d",dict[i],&s[i]); gets(desc); for(i=0;i<n;i++) { int sum=0; while(gets(desc) && strcmp(desc,".")) { for(j=0;j<m;j++) { char * p=desc; int len=strlen(dict[j]); while(p=strstr(p,dict[j])) { sum+=s[j]; p+=len; } } } printf("%d\n",sum); } return 0; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator