-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path11047.py
45 lines (34 loc) · 975 Bytes
/
11047.py
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
42
43
44
45
# [ 백준 ] 11047번: 동전 0
def solution() -> None:
N, K = list(map(int, input().split(" ")))
A: list[int] = []
for _ in range(N):
coin: int = int(input())
if coin <= K:
A.insert(0, coin)
answer: int = 0
for coin in A:
answer += (K // coin)
K %= coin
print(answer)
if __name__ == "__main__":
import io
import unittest.mock
def test_example_case() -> None:
with unittest.mock.patch("builtins.input", side_effect=[
"10 4200",
"1",
"5",
"10",
"50",
"100",
"500",
"1000",
"5000",
"10000",
"50000",
]):
with unittest.mock.patch("sys.stdout", new_callable=io.StringIO) as test_stdout:
solution()
assert test_stdout.getvalue() == "6\n"
test_example_case()