Source code for submission s860

Go to diff to previous submission

mosquito.cpp

  1. #include <iostream>
  2. #include <algorithm>
  3. #include <cassert>
  4. #include <vector>
  5. #include <cmath>
  6.  
  7. using namespace std;
  8.  
  9. int f3(int m, int e, int r, int s, int n)
  10. {
  11. for(; n>0; n-=3)
  12. {
  13. m = floor(floor((m*e)/float(r))/float(s));
  14. }
  15. return m;
  16. }
  17.  
  18.  
  19.  
  20. int main()
  21. {
  22. while(true)
  23. {
  24. int M, P, L, E, R, S, N;
  25. cin>>M>>P>>L>>E>>R>>S>>N;
  26. if(!cin) break;
  27. for(int i=0; i<N; ++i)
  28. {
  29. int Mn = P/S;
  30. P = L/R;
  31. L = M*E;
  32. M=Mn;
  33. }
  34. /*
  35. if(N%3==0)
  36. {
  37. M = f3(M, E, R, S, N);
  38.  
  39. }
  40. else if(N%3==2)
  41. {
  42. M = floor(floor(L/float(R))/float(S));
  43. M = f3(M, E, R, S, N);
  44. }
  45. else
  46. {
  47. M = floor(P/float(S));
  48. M = f3(M, E, R, S, N);
  49. }
  50. */
  51. cout << M << endl;
  52. }
  53. return 0;
  54. }
  55.  
  56.  
  57.  
  58.  

Diff to submission s841

mosquito.cpp

--- 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;
         }