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 1861. Graveyard in Deyja

I'm angry!
Posted by Felix_Mate 22 Jun 2017 23:43
I wrote program on C++ and got WA1. I rewrote program on Pascal and got AC.
I think my error in input string. How do i read lines? My attempts:
1)
     int c;
     n=0;
     while ((c = getchar()) != EOF)
     {
          if(c=='\n') break;
          s[++n]=c;
     }
     m=0;
     while ((c = getchar()) != EOF) t[++m]=(char)c;
2)
void Input()
{
     int c;
     scanf("%c",&c);
     n=0;
     while (c!='\n')
     {
          s[++n]=c;
          scanf("%c",&c);
     }
     m=0;
     while ((c = getchar()) != EOF) t[++m]=(char)c;
}

Probably <string> will help, but i prefer work with index>=1.

Edited by author 22.06.2017 23:44

Edited by author 22.06.2017 23:44