본문 바로가기
python-algorithm

백준 26350 Good Coin Denomination

by 무적김두칠 2022. 12. 22.

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
반응형

'python-algorithm' 카테고리의 다른 글

백준 6887 Squares  (0) 2022.12.22
백준 5357 Dedupe  (0) 2022.12.22
백준 5300 Fill the Rowboats!  (0) 2022.12.22
백준 25756 방어율 무시 계산하기  (0) 2022.12.22
백준 24072 帰省 (Homecoming)  (0) 2022.12.22

댓글