Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- n = int(input()) # кол-во розеток в комнате
- m = int(input()) # кол-во электроприборов
- a = int(input()) # цена разветвителя. даёт +1 розетку
- b = int(input()) # цена мультиплексора. даёт +4 розеток
- ans = 0
- if m > n:
- c = m - n # кол-во оставшихся приборов
- if 4 * a <= b:
- ans = c * a
- print(ans)
- else:
- ans += (c // 4) * b
- if (c % 4) * a > b:
- ans += b
- print(ans)
- else:
- ans += (c % 4) * a
- print(ans)
- else:
- print(0)
Advertisement
Add Comment
Please, Sign In to add comment