10949 - Kids in a Grid

All about problems in Volume 109. If there is a thread about your problem, please use it. If not, create one with its number in the subject.

Moderator: Board moderators

brianfry713
Guru
Posts: 5947
Joined: Thu Sep 01, 2011 9:09 am
Location: San Jose, CA, USA

Re: 10949 - Kids in a Grid

Post by brianfry713 »

Code: Select all

      int i =1;
      while(c!='\n'){

         if (c == 'N')
            x -= 1;
         else if (c == 'S')
            x += 1;
         else if (c == 'W')
            y -= 1;
         else
            y += 1;
         s1[i] = grid[x][y];
         c = getchar();
      }
You aren't incrementing i here.
Check input and AC output for thousands of problems on uDebug!
Post Reply

Return to “Volume 109 (10900-10999)”