SHARE
TWEET

I/O recebe AC

a guest Mar 2nd, 2015 207 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. char board[32][32];
  2. void build( int *len, char s[] ){
  3.  
  4.     char l;
  5.     int x,y,k=0;
  6.     scanf("%d%d%d\n", len, &x, &y);
  7.     x--;y--;
  8.  
  9.     s[k++] = board[x][y];
  10.     for( int i = 0; i < (*len); i++ ){
  11.         scanf("%c", &l );
  12.  
  13.         if( l == 'N' ) x--;
  14.  
  15.         else if( l == 'S') x++;
  16.  
  17.         else if( l == 'E') y++;
  18.  
  19.         else y--;
  20.  
  21.         s[k++] = board[x][y];
  22.     }
  23.     s[k] = '\0';
  24.     (*len) = k;
  25. }
  26.  
  27. int main( void ){
  28.  
  29.     int t,h,w;
  30.     scanf("%d", &t );
  31.     for( int c = 1; c <= t; c++ ){
  32.         memset(memo,false,sizeof(memo));
  33.  
  34.         scanf("%d%d\n", &h, &w );
  35.  
  36.         for( int i = 0; i < h; i++ ) scanf("%s", board[i] );        
  37.      
  38.         build(&len1,s1);
  39.         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