SHARE
TWEET

I/O recebe WA

a guest Mar 2nd, 2015 191 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. char board[21][21];
  2. void build( int *len, char s[] ){
  3.  
  4.     char l;
  5.     int x,y,k=0;
  6.     scanf(" %d", len );
  7.     scanf(" %d %d", &x, &y);
  8.     x--;y--;
  9.  
  10.     s[k++] = board[x][y];
  11.     for( int i = 0; i < (*len); i++ ){
  12.         scanf(" %c", &l );
  13.  
  14.         if( l == 'N' ) x--;
  15.  
  16.         else if( l == 'S') x++;
  17.  
  18.         else if( l == 'E') y++;
  19.  
  20.         else y--;
  21.  
  22.         s[k++] = board[x][y];
  23.     }
  24.     s[k] = '\0';
  25.     (*len) = k;
  26. }
  27.  
  28. int main( void ){
  29.  
  30.     int t,h,w;
  31.     scanf(" %d", &t );
  32.     for( int c = 1; c <= t; c++ ){
  33.         memset(memo,false,sizeof(memo));
  34.  
  35.         scanf(" %d %d", &h, &w );
  36.  
  37.         for( int i = 0; i < h; i++ ) scanf(" %s", board[i] );            
  38.      
  39.         build(&len1,s1); build(&len2,s2);
  40.  
  41.         Stt ans = S(0,0);
  42.      
  43.         printf("Case %d: %d %d\n", c, ans.u1, ans.u2 );
  44.     }
  45.  
  46.     return 0;
  47. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top