Advertisement
Guest User

Untitled

a guest
Oct 16th, 2019
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. c, x, y, z, m, s, f, e, t = map(int, input().split())
  2. t1, x1 = 0, 0
  3. t2, x2 = 0, 0
  4. e += 1
  5. while e > 0:
  6. t1 += m
  7. kol_g = s + x1
  8. x1 = 0
  9. e -= (kol_g // f)
  10. x1 = kol_g % f
  11. if x1 > x:
  12. x1 = x
  13. t1 += t
  14. while c > x:
  15. t2 += m
  16. kol_g = s + x2
  17. x2 = 0
  18. if ((kol_g // y) * z) + x > c:
  19. if (c - x) % z != 0:
  20. x2 += (kol_g - (((((c - x) // z) * z + z) // z) * y))
  21. x += (((c - x) // z) * z + z)
  22. else:
  23. x2 += (kol_g - (((c - x) // z) * y))
  24. x += (c - x)
  25.  
  26. else:
  27. x += ((kol_g // y) * z)
  28. x2 += (kol_g % y)
  29. if x2 > x:
  30. x2 = x
  31. if (c - x2) % s != 0:
  32. t2 += ((((c - x2) // s) + 1) * m)
  33. else:
  34. t2 += (((c - x2) // s) * m)
  35. print(min([t1, t2]))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement