Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int timeCalc(int SumCost, int m, int s)
- {
- int res = (SumCost / s) * m;
- if (SumCost % s != 0) res += m;
- return res;
- }
- int main()
- {
- int c, x, y, z, m, s, f, e, t;
- cin » c » x » y » z » m » s » f » e » t;
- int p = e + 1;
- int res = 0;
- int sc = 0;
- if (c > x) {
- int Nh = (c - x) / z;
- if ((c - x) % z != 0) Nh++;
- sc = Nh*y + c;
- }
- else {
- sc = c;
- }
- int sf = p * f;
- int rc = timeCalc(sc, m, s);
- int rf = timeCalc(sf, m, s) + t;
- if (rc > rf) res = rf;
- else res = rc;
- cout « res;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement