Advertisement
Guest User

Untitled

a guest
Oct 16th, 2019
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.59 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4. int timeCalc(int SumCost, int m, int s)
  5. {
  6.  int res = (SumCost / s) * m;
  7.  if (SumCost % s != 0) res += m;
  8.  return res;
  9. }
  10. int main()
  11. {
  12.  int c, x, y, z, m, s, f, e, t;
  13.  cin » c » x » y » z » m » s » f » e » t;
  14.  int p = e + 1;
  15.  int res = 0;
  16.  int sc = 0;
  17.   if (c > x) {
  18.   int Nh = (c - x) / z;
  19.   if ((c - x) % z != 0) Nh++;
  20.   sc = Nh*y + c;
  21.  }
  22.  else {
  23.   sc = c;
  24.  }
  25.  int sf = p * f;
  26.  int rc = timeCalc(sc, m, s);
  27.  int rf = timeCalc(sf, m, s) + t;
  28.  if (rc > rf) res = rf;
  29.  else res = rc;
  30.  cout « res;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement