• Sign Up
• Login
• API
• FAQ
• Tools
• Archive
SHARE
TWEET

# Untitled

lalalalalalalaalalla Nov 5th, 2019 15 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1. def Wholesale(N, A, B, C, D):
2.     res = N
3.     for x in range((N + A - 1) // A + 1):
4.
5.         if x * A < N:
6.             y = (N - x * A) // C
7.         else:
8.             y = 0
9.
10.         if N - x * A - y * C > 0:
11.             z = N - x * A - y * C
12.         else:
13.             z = 0
14.
15.         if res > min(x * B + y * D + z, x * B + (y + 1) * D):
16.             res = min(x * B + y * D + z, x * B + (y + 1) * D)
17.     return res
18.
19. N = int(input())
20. A = int(input())
21. B = int(input())
22. C = int(input())
23. D = int(input())
24. print(Wholesale(N, A, B, C, D))
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy.
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!

Top