|
|
вернуться в форум# Test 2 ... What is wrong with my code? :( #include <stdio.h> #include <stdlib.h> int main (){ int N; scanf ("%d",&N); for (int i = 0 ; i < N ; i++){ char x; int y; getchar(); scanf ("%c %d",&x,&y); int movimientos = 0;
if (y + 2 <= 8) if (x - 1 >= 97){ movimientos++; }
if (y+2 <=8) if (x + 1<=104){ movimientos++; } if (y-2 >= 1) if (x-1 >97){ movimientos++; } if (y-2 >= 1) if (x + 1 <= 104){ movimientos++; }
if (x+2 <= 104) if (y - 1 >= 1){ movimientos++; } if (x+2 <= 104) if (y+1 <= 8){ movimientos++; } if (x-2 >= 97) if (y+1 <= 8){ movimientos++; } if (x-2 >= 97) if (y-1 >= 1){ movimientos++; } printf ("\n %d", movimientos); printf ("\n"); }
return 0; } Edited by author 21.10.2020 01:36 Edited by author 21.10.2020 01:37 Re: # Test 2 ... just had to consider from 'a' 'h' and '1' '8' |
|
|