|
|
вернуться в форумWhy I got WA?Is there some special test data I got WA?Who can give me a hand?Thank you! My program: #include<stdio.h> long n9,n; int a,b; void main(void) { int i,j,l; scanf("%ld",&n); n9=0; l=-1; for (i=0;i<n;i++) { scanf("%d %d",&a,&b); if (a+b==9) n9++; if (n9==0) { if (l!=-1) printf("%d",(a+b)/10+l); if (l==-1 && a+b>9) printf("%d",(a+b)/10); l=(a+b)%10; } else if (n9!=0 && a+b<9) { printf("%d",l); for (j=0;j<n9;j++) printf("9"); n9=0; l=a+b; } else if (n9!=0 && a+b>9) { printf("%d",l+1); for (j=0;j<n9;j++) printf("0"); n9=0; printf("%d",a+b-10); l=-1; } } if (n9!=1) for (i=0;i<n9;i++) printf("9"); if (l!=-1) printf("%d\n",l); if (n==0) printf("%d\n",0); } It is writed by C++,and got WA. If there is some special test data makes my program got WA.May I have it? Thank you! Re: Why I got WA?Is there some special test data I got WA?Who can give me a hand?Thank you! Try these tests : 1 + 8 2 + 7 14 + 5 46 + 3 58 + 1 . . . . and so on . If you still get WA send me an email . ciutu@go.ro Re: Why I got WA?Is there some special test data I got WA?Who can give me a hand?Thank you! > Try these tests : > > 1 + 8 > 2 + 7 > 14 + 5 > 46 + 3 > 58 + 1 > . > . > . > . > and so on . > > If you still get WA send me an email . ciutu@go.ro I accpet these tests,but I still got WA!? Re: Why I got WA?Is there some special test data I got WA?Who can give me a hand?Thank you! > > Try these tests : > > > > 1 + 8 > > 2 + 7 > > 14 + 5 > > 46 + 3 > > 58 + 1 > > . > > . > > . > > . > > and so on . > > > > If you still get WA send me an email . ciutu@go.ro > I accpet these tests,but I still got WA!? my program: #include<stdio.h> long n9,n; int a,b; void main(void) { int i,j,l; scanf("%ld",&n); n9=0; l=-1; for (i=0;i<n;i++) { scanf("%d %d",&a,&b); if (a+b==9) n9++; if (n9==0) { if (l==-1) if (a+b>9) printf("%d",(a+b)/10); if (l!=-1 && a+b>9) printf("%d",l+((a+b)/10)); if (l!=-1 && a+b<9) printf("%d",l); l=(a+b)%10; } else if (n9!=0 && a+b<9) { printf("%d",l); for (j=0;j<n9;j++) printf("9"); n9=0; } else if (n9!=0 && a+b>9) { printf("%d",l+1); for (j=1;j<n9;j++) printf("0"); n9=0; } } if (l!=-1) printf("%d",l); else printf("0"); if (n9!=0) for (i=0;i<n9;i++) printf("9"); } |
|
|