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]; 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) { d = y2 / y1; if (d != 1) x = x / (d * (N / 3)); } } else { if ( N >= 3) x = 0; }*/ for (int i = 1; i <= N/3; i++) { x = (x*y1) / y2; } printf("%i\n",x); } return 0; }
--- c4.s745.cteam114.mosquito.cpp.0.mosquito.cpp +++ c4.s786.cteam114.mosquito.cpp.0.mosquito.cpp @@ -24,33 +24,39 @@ } - int d; + /*int d; if ((y1 != 0) && (N >= 3)) { - if (y1 > y2) - { - d = y1 / y2; - if (d != 1) - x = x * (d * (N / 3)); - } - if (y1 < y2) - { - d = y2 / y1; - if (d != 1) - x = x / (d * (N / 3)); - } + if (y1 > y2) + { + d = y1 / y2; + if (d != 1) + x = x * (d * (N / 3)); } - - else + if (y1 < y2) { - if ( N >= 3) - x = 0; + d = y2 / y1; + if (d != 1) + x = x / (d * (N / 3)); + } } + else + { + if ( N >= 3) + x = 0; + }*/ + + for (int i = 1; i <= N/3; i++) + { + x = (x*y1) / y2; + } + + printf("%i\n",x); -} -return 0; + } + return 0; } \ No newline at end of file