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 |
Re:WA。。。。。。。WHY?In Reply To:WA。。。。。。。WHY? Posted by:o8103421oo at 2009-07-24 10:42:55 > #include "stdio.h" > #include "string.h" > int main(void) > { > char *p,word[1000][18],s[100][1000]; > long int dollar[1000]={0},cnt[100][1000]={0}; > int len,i=0,j=0,m,n; > __int64 sum[100]={0}; > > scanf("%d%d",&m,&n); > if(m<=1000 && n<=100) > { > for(i=0;i<m;i++) > scanf("%s %d",word[i],&dollar[i]); > for(j=0;j<n;j++) > { > len =0; > > while(gets(s[j]+len),len=strlen(s[j]),s[j][len-1]!='.' ); > } > > > for(j=0;j<n;j++) > for(i=0;i<m;i++) > { > while(p=strstr(s[j],word[i])) > { > cnt[j][i]++; > > *p='*'; > > > > } > sum[j]+=cnt[j][i]*dollar[i]; > } > > for(j=0;j<n;j++) > printf("%d\n",sum[j]); > > } > > return 0; > } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator