結果

問題 No.2681 ゲームセンターの両替
ユーザー Ekiben542Ekiben542
提出日時 2024-03-21 14:41:08
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 559 bytes
コンパイル時間 309 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 59,132 KB
最終ジャッジ日時 2024-03-21 14:41:10
合計ジャッジ時間 2,462 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 35 ms
53,460 KB
testcase_01 AC 36 ms
53,460 KB
testcase_02 AC 36 ms
53,460 KB
testcase_03 AC 39 ms
59,132 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 47 ms
59,132 KB
testcase_07 AC 40 ms
59,132 KB
testcase_08 AC 43 ms
59,120 KB
testcase_09 AC 42 ms
59,132 KB
testcase_10 AC 39 ms
59,132 KB
testcase_11 WA -
testcase_12 AC 36 ms
53,460 KB
testcase_13 AC 43 ms
53,460 KB
testcase_14 AC 36 ms
53,460 KB
testcase_15 AC 36 ms
53,460 KB
testcase_16 AC 36 ms
53,460 KB
testcase_17 AC 37 ms
53,460 KB
testcase_18 AC 36 ms
53,460 KB
testcase_19 AC 36 ms
53,460 KB
testcase_20 AC 36 ms
53,460 KB
testcase_21 AC 36 ms
53,460 KB
testcase_22 WA -
testcase_23 AC 36 ms
53,460 KB
testcase_24 AC 36 ms
53,460 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def exchange(C, Y):
    coins = [0]*10
    currency = [1, 5, 10, 50, 100, 500, 1000, 2000, 5000, 10000]
    
    for i in range(9, -1, -1):
        coins[i] = Y // currency[i]
        Y %= currency[i]
    
    if coins[4] >= C:
        return "no exchange"
    
    for i in range(5, 10):
        while coins[i] > 0 and coins[4] < C:
            coins[i] -= 1
            coins[4] += 5
            coins[5] += 1
    
    if coins[4] >= C:
        return coins[4]
    else:
        return "can't exchange"
C, Y = map(int, input().split())
print(exchange(C, Y))
0