Go to diff to previous submission
#include <iostream> #include <algorithm> #include <cassert> #include <vector> #include <cmath> using namespace std; int f3(int m, int e, int r, int s, int n) { for(; n>0; n-=3) { m = floor(floor((m*e)/float(r))/float(s)); } return m; } int main() { while(true) { int M, P, L, E, R, S, N; cin>>M>>P>>L>>E>>R>>S>>N; if(!cin) break; for(int i=0; i<N; ++i) { int Mn = P/S; P = L/R; L = M*E; M=Mn; } /* if(N%3==0) { M = f3(M, E, R, S, N); } else if(N%3==2) { M = floor(floor(L/float(R))/float(S)); M = f3(M, E, R, S, N); } else { M = floor(P/float(S)); M = f3(M, E, R, S, N); } */ cout << M << endl; } return 0; }
--- c4.s841.cteam038.mosquito.cpp.0.mosquito.cpp +++ c4.s860.cteam038.mosquito.cpp.0.mosquito.cpp @@ -25,4 +25,12 @@ cin>>M>>P>>L>>E>>R>>S>>N; if(!cin) break; + for(int i=0; i<N; ++i) + { + int Mn = P/S; + P = L/R; + L = M*E; + M=Mn; + } + /* if(N%3==0) { @@ -39,4 +48,5 @@ M = f3(M, E, R, S, N); } + */ cout << M << endl; }