Source code for submission s841

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. if(N%3==0)
  28. {
  29. M = f3(M, E, R, S, N);
  30. }
  31. else if(N%3==2)
  32. {
  33. M = floor(floor(L/float(R))/float(S));
  34. M = f3(M, E, R, S, N);
  35. }
  36. else
  37. {
  38. M = floor(P/float(S));
  39. M = f3(M, E, R, S, N);
  40. }
  41. cout << M << endl;
  42. }
  43. return 0;
  44. }
  45.  
  46.  
  47.  
  48.