Go to diff to previous submission
#include <stdio.h> #include <math.h> int R,C, Lr, Lc, Gr, Gc; int get_dist(int a, int b, int x, int y) { } int main() { { int d = get_dist(Gr, Gc, Lr, Lc); int result = 0; if (d == 0) { } else if (R == 1 || C == 1) { } else if (R == 2 || C == 2) { int t = (x > y) ? x : y; if (Gc == Lc || Gr == Lr) { if (t % 4 == 0) { } else { if ((t+2) % 4 == 0) { } } else if (R == 3 && C == 3) { else { switch(d) { case 1: break; case 2: break; case 3: break; case 4: break; case 5: break; } } } else { while (x > 2 || y > 2 ) { if (x > y) { x -= 2; y--; if (y<0) y = 1; } else { y -= 2; x--; if (x<0) x = 1; } result++; } switch(x+y) { case 1: break; case 2: break; case 3: break; case 4: break; } } } return 0; }
--- c4.s1271.cteam074.grasshop.c.0.grasshop.c +++ c4.s1299.cteam074.grasshop.c.0.grasshop.c @@ -35,4 +35,5 @@ } else if (R == 3 && C == 3) { if (Lr == 2 && Lc == 2) printf("impossible\n"); + else if (Gr == 2 && Gc == 2) printf("impossible\n"); else { switch(d) { @@ -40,4 +41,7 @@ printf("3\n"); break; + case 2: + printf("2\n"); + break; case 3: printf("1\n"); @@ -56,9 +60,9 @@ x -= 2; y--; - if (y<0) y = 2; + if (y<0) y = 1; } else { y -= 2; x--; - if (x<0) x = 2; + if (x<0) x = 1; } result++;