Go to diff to previous submission
#include <iostream> using namespace std; int main() { unsigned long long M,P,L,E,R,S,N; unsigned long long Mt_3,Mt_2,Mt_1; while(1) { if(cin.eof()) break; cin >> M >> P >> L >> E >> R >> S >> N; // Mt_3 = P/S; Mt_2 = L/R/S; Mt_1 = M*E/R/S; // if(N == 1) M = Mt_3; else if(N == 2) M = Mt_2; else if(N == 3) M = Mt_1; else { for(int n = 3; n < N; n++) { //if(Mt_3 >= R*S) M = (Mt_3/R/S)*E; /*else */M = (Mt_3*E)/R/S; // Mt_3 = Mt_2; Mt_2 = Mt_1; Mt_1 = M; } } cout << M << '\n'; } return 0; }
--- c4.s738.cteam054.mosquito.cpp.0.mosquito.cpp +++ c4.s894.cteam054.mosquito.cpp.0.mosquito.cpp @@ -4,6 +4,6 @@ int main() { - int M,P,L,E,R,S,N; - int Mo,Po,Lo; + unsigned long long M,P,L,E,R,S,N; + unsigned long long Mt_3,Mt_2,Mt_1; while(1) { @@ -11,11 +11,25 @@ cin >> M >> P >> L >> E >> R >> S >> N; // - for(int n = 0; n < N; n++) + Mt_3 = P/S; + Mt_2 = L/R/S; + Mt_1 = M*E/R/S; + // + if(N == 1) + M = Mt_3; + else if(N == 2) + M = Mt_2; + else if(N == 3) + M = Mt_1; + else { - Mo = M; Po = P; Lo = L; - // - L = Mo*E; - P = Lo/R; - M = Po/S; + for(int n = 3; n < N; n++) + { + //if(Mt_3 >= R*S) M = (Mt_3/R/S)*E; + /*else */M = (Mt_3*E)/R/S; + // + Mt_3 = Mt_2; + Mt_2 = Mt_1; + Mt_1 = M; + } } cout << M << '\n';