Source code for submission s843

Go to diff to previous submission

grasshop.cpp

  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <math.h>
  4.  
  5. int pole[200][200];
  6. int a,b,c,d,e,f;
  7.  
  8. int cesta(int zx, int zy)
  9. {
  10.  
  11. }
  12.  
  13.  
  14. int main()
  15. {
  16. while(scanf("%i %i %i %i %i %i",&a,&b,&c,&d,&e,&f)==6)
  17. {
  18. int dx = abs(c-e);
  19. int dy = abs(f-d);
  20.  
  21.  
  22. }
  23. return 0;
  24. }

Diff to submission s809

grasshop.cpp

--- c4.s809.cteam114.grasshop.cpp.0.grasshop.cpp
+++ c4.s843.cteam114.grasshop.cpp.0.grasshop.cpp
@@ -3,118 +3,21 @@
 #include <math.h>
 
+int pole[200][200];
+int a,b,c,d,e,f;
+
+int cesta(int zx, int zy)
+{
+                
+}
+
+
 int main()
 {
-        int a,b,c,d,e,f;
         while(scanf("%i %i %i %i %i %i",&a,&b,&c,&d,&e,&f)==6)
         {
                 int dx = abs(c-e);
                 int dy = abs(f-d);
-
-                if (dx == 0 && dy == 0)
-                {
-                        printf("0\n");
-                        continue;
-                }
-
-                if (a < 3 && b < 3)
-                {
-                        printf("impossible\n");
-                        continue;
-                }
-
-                if (a==3 && b == 3 && c == 2 && d == 2)
-                {
-                        printf("impossible\n");
-                        continue;
-                }
-
-                if (a==3 && b == 3 && e == 2 && f == 2)
-                {
-                        printf("impossible\n");
-                        continue;
-                }
-
-                if (a == 2)
-                {
-                        if (dy%2 != 0)
-                        {
-                                printf("impossible\n");
-                                continue;
-                        }
-                        if ((dy%4 == 0 && dx == 0) || (dy%4 != 0 && dx == 1))
-                        {
-                                printf("%i\n", dy/2);
-                                continue;
-                        }
-                        printf("impossible\n");
-                        continue;
-                }
-
-                if (b == 2)
-                {
-                        if (dx%2 != 0)
-                        {
-                                printf("impossible\n");
-                                continue;
-                        }
-                        if ((dx%4 == 0 && dy == 0) || (dx%4 != 0 && dy == 1))
-                        {
-                                printf("%i\n", dx/2);
-                                continue;
-                        }
-                        printf("impossible\n");
-                        continue;
-                }
-
-                int n = 0;
-                while (dx > 2 || dy > 2)
-                {
-                        if (dx > dy)
-                        {
-                                dx = abs(dx- 2);
-                                dy = abs(dy -1);
-                        }
-                        else
-                        {                       
-                                dx = abs(dx- 2);
-                                dy = abs(dy -1);
-                        }
-                        n++; 
-                }
- 
-
-                if (dx == 0 && dy == 0) n += 0;
-                if (dx == 0 && dy == 1) n += 3;
-                if (dx == 0 && dy == 2) 
-                {
-                        if ((a == 3) && ((f == 1) || (f == b-1)) && (e == 2))
-                                n+= 4;
-                        else
-                                n += 2;
-                }
-
-                if (dx == 1 && dy == 0) n += 3;
-                if (dx == 1 && dy == 1) 
-                {
-                        if ((e == a-1) || (f == b-1) || (e==1) || (f == 1) )
-                                n += 4;
-                        else
-                                n += 2;
-                }
-                if (dx == 1 && dy == 2) n += 1;
-
-                if (dx == 2 && dy == 0) 
-                {
-                        if ((b == 3) && ((e == 1) || (e == a-1)) && (f == 2))
-                                n+= 4;
-                        else
-                                n += 2;
-                }
-                if (dx == 2 && dy == 1) n += 1;
-                if (dx == 2 && dy == 2) n += 4;
-
-                printf("%i\n",n);
-                continue;
                 
+                                
         }       
         return 0;