Go to diff to previous submission
#include <stdio.h> #include <stdlib.h> #include <math.h> int main() { int a[3]; int b[3]; int N; while(scanf("%i %i %i %i %i %i %i",&a[0],&a[1],&a[2],&b[0],&b[1],&b[2], &N)==7) { int z = N % 3; int x = a[z]; for (int i = N; i >= 1; i--) { z = i % 3; if (z == 0) x = x * b[0]; else x = x / b[z]; } printf("%i\n",x); } return 0; }
--- c4.s815.cteam114.mosquito.cpp.0.mosquito.cpp +++ c4.s847.cteam114.mosquito.cpp.0.mosquito.cpp @@ -15,44 +15,13 @@ int x = a[z]; - int y2 = b[1] * b[2]; - - int y1 = b[0]; - - for (int i = z; i>=1; i--) - { - x = x / b[i]; - } - - /*int d; - - if ((y1 != 0) && (N >= 3)) - { - - if (y1 > y2) - { - d = y1 / y2; - if (d != 1) - x = x * (d * (N / 3)); - } - if (y1 < y2) + for (int i = N; i >= 1; i--) { - d = y2 / y1; - if (d != 1) - x = x / (d * (N / 3)); - } + z = i % 3; + if (z == 0) + x = x * b[0]; + else + x = x / b[z]; } - else - { - if ( N >= 3) - x = 0; - }*/ - - for (int i = 1; i <= N/3; i++) - { - x = (x*b[0]) / b[2] / b[1]; - } - - printf("%i\n",x);