ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1048. Superlong Sums

Why 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.
Posted by Erast V. Kunenkov 19 Nov 2002 22:02
Try 73 + 26 or something similar, with multiple '9' at the end of output.