|
|
back to boardWhy I get WA? Pls, help me. Posted by petrik 9 Nov 2002 20:48 This is my code: #include <stdio.h> int main() { int n,i,buf=0,p1,p2,vypis; scanf("%d %d %d", &n, &p1, &p2); vypis=p1+p2; if (vypis>=10) printf("1"); vypis=(p1+p2)%10; for ( i=0; i<n-1; i++ ) { scanf("%d %d", &p1, &p2); if (p1+p2==9) {buf++; continue;} if (p1+p2>=10) { printf("%d", vypis+1); for ( ; buf>0; buf-- ) printf("0"); } if (p1+p2<9) { printf("%d", vypis); for ( ; buf>0; buf-- ) printf("9"); } vypis=(p1+p2)%10; } printf("%d\n", vypis); return 0; } Re: Why I get WA? Pls, help me. Try 73 + 26 or something similar, with multiple '9' at the end of output. |
|
|