-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBoj11047.py
More file actions
41 lines (30 loc) · 1009 Bytes
/
Boj11047.py
File metadata and controls
41 lines (30 loc) · 1009 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import math
# 11047
N, K = map(int, input().split())
kindsOfCoins = []
for _ in range(N):
temp = int(input())
kindsOfCoins.append(temp)
numOfCoins = 0
while K != 0:
for i in range(len(kindsOfCoins)):
if K / int(kindsOfCoins[len(kindsOfCoins) - (i+1)]) == 0:
continue
else:
numOfCoins += math.floor(K / int(kindsOfCoins[len(kindsOfCoins) - (i+1)]))
K %= int(kindsOfCoins[len(kindsOfCoins) - (i+1)])
print(numOfCoins)
# with open("./input.txt", "r") as f:
# N, K = map(int, f.readline().split())
# for _ in range(N):
# temp = f.readline()
# kindsOfCoins.append(temp)
# numOfCoins = 0
# while K != 0:
# for i in range(len(kindsOfCoins)):
# if K / int(kindsOfCoins[len(kindsOfCoins) - (i+1)]) == 0:
# continue
# else:
# numOfCoins += math.floor(K / int(kindsOfCoins[len(kindsOfCoins) - (i+1)]))
# K %= int(kindsOfCoins[len(kindsOfCoins) - (i+1)])
# print(numOfCoins)