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,我的测试都没错啊?#include<stdio.h> #include<string.h> void main() { char a[10000][6]; int s[10001],mark[10000]; int n,l,m,i,j,k=0; int left_t=0,right_t=0; scanf("%d",&n); for(i=0;i<n;i++) { left_t=0;right_t=0; scanf("%d %d",&l,&m); for(j=0;j<m;j++) { scanf("%d %s",&s[j],a[j]); mark[j]=0; } for(j=0;j<m-1;j++) { for(k=j+1;k<m;k++) { if(mark[j]==0&&mark[k]==0&&(!strcmp(a[j],a[k]))&&s[j]+s[k]<=l*100) { s[j]=s[j]+s[k]; mark[k]=1; } } } // for(j=0;j<m;j++) // printf("%d !!%s!! %d\n",s[j],a[j],mark[j]); for(j=0;j<m;j++) { if(a[j][0]=='l'&&mark[j]==0) left_t++; if(a[j][0]=='r'&&mark[j]==0) right_t++; } // printf("2*left_t-1=%d 2*right_t= %d\n",2*left_t-1,2*right_t); if(left_t>right_t) printf("%d\n",2*left_t-1); else printf("%d\n",2*right_t); } } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator