Advertisement
ln_sfna

Untitled

Oct 15th, 2019
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. def min(x,y):
  2. if x>=y:
  3. return y
  4. elif y>=x:
  5. return x
  6.  
  7.  
  8. c, x, y, z, m, s,f, e, t= input().split()
  9. c = int(c)
  10. x = int(x)
  11. y = int(y)
  12. z = int(z)
  13. m = int(m)
  14. s = int(s)
  15. f = int(f)
  16. e = int(e)
  17. t = int(t)
  18.  
  19. time=0
  20. time1=0
  21. time2=0
  22. if c<=x:
  23. if c%s==0:
  24. time = m*(c//s)
  25. else:
  26. time = (m*(c//s))+m
  27. print(time)
  28. elif c>x:
  29. newstoragecost=0
  30. if (c-x)%z ==0:
  31. newstoragecost = y*((c-x)//z)
  32. money = c + newstoragecost
  33. if money % s == 0:
  34. time1 = (money // s)* m
  35. else:
  36. time1 = ((money // s)* m) + m
  37. else:
  38. newstoragecost = (y*((c-x)//z)) + y
  39. money = c + newstoragecost
  40. if money % s == 0:
  41. time1 = (money // s)* m
  42. else:
  43. time1 = ((money // s)* m) + m
  44. infantrycost= (e+1)*f
  45. if infantrycost % s == 0:
  46. time2 = (infantrycost // s) * m +t
  47. else:
  48. time2 = ((infantrycost// s) * m) + m + t
  49. print (min(time1, time2))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement