Source code for submission s848

mosquito.cpp

  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4. #include <stdint.h>
  5. #include <ctype.h>
  6. #include <math.h>
  7.  
  8. #include <string>
  9. #include <vector>
  10. #include <map>
  11. #include <set>
  12. #include <algorithm>
  13.  
  14. using namespace std;
  15.  
  16. typedef pair <int, int> PII;
  17. typedef long long int LL;
  18. typedef vector <int> VI;
  19. typedef vector <LL> VLL;
  20.  
  21. #define FOR(i, a, b) for ( int i = a; i < b; ++i )
  22. #define FORD(i, a, b) for ( int i = a-1; i >= 0; --i )
  23.  
  24. #define FILL(x, v, n) for ( int _i = 0; _i < n; ++_i ) x[_i] = v;
  25.  
  26. int main()
  27. {
  28. int M[2], P[2], L[2], E, R, S, N;
  29. while ( scanf( "%d %d %d %d %d %d %d", &M[0], &P[0], &L[0], &E, &R, &S, &N) == 7 )
  30. {
  31. int id = 0, nid;
  32. FOR(i,0,N)
  33. {
  34. nid = (id + 1) % 2;
  35. L[ nid ] = E * M[ id ];
  36. P[ nid ] = L[ id ] / R;
  37. M[ nid ] = P[ id ] / S;
  38. id = nid;
  39. }
  40. printf( "%d\n", M[ id ] );
  41. }
  42. return 0;
  43.  
  44. }
  45.