python-algorithm
백준 26350 Good Coin Denomination
무적김두칠
2022. 12. 22. 12:00
https://www.acmicpc.net/problem/26350
26350번: Good Coin Denomination
Different countries use different coin denominations. For example, the USA uses 1, 5, 10, and 25. A desirable property of coin denominations is to have each coin at least twice the amount of its previous coin in sorted order. For example, the USA denominat
www.acmicpc.net
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
def sol(coins):
flag = False
for i in range(1,len(coins)):
if 2*coins[i-1]>coins[i]:
flag = True
break
print("Denominations:", *coins)
if flag:
print("Bad coin denominations!")
else:
print("Good coin denominations!")
if __name__ == '__main__':
n = int(input())
for _ in range(n):
nums = list(map(int, input().split()))[1:]
sol(nums)
if _!=n-1:
print()
|
cs |
반응형