Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import math
- c, x, y, z, m, s, f, e, t = map(int, input().split())
- # x = int(input())
- # y = int(input())
- # print(x//y)
- # набор монет
- coins = 0
- i_coins = 0 # кол во ходов
- storages = 0 # кол во хранилищ
- storages_need = math.ceil((c-x)/z)
- # покупаем хранилища
- while storages < storages_need:
- i_coins += 1
- coins += s
- storages_buy = min(storages_need-storages, coins//y)
- coins -= storages_buy*y
- storages += storages_buy
- coins = min(storages*z + x, coins)
- i_coins += math.ceil((c-coins)/s)
- # смэрть
- coins = 0
- i_war = 0 # кол во ходов
- wars = 0
- while e >= 0:
- i_war += 1
- coins += s
- wars_buy = coins//f
- coins -= wars_buy*f
- e -= wars_buy
- print(min(i_coins*m, i_war*m + t))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement