結果

問題 No.2681 ゲームセンターの両替
ユーザー 寝癖寝癖
提出日時 2024-03-20 23:19:24
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 44 ms / 2,000 ms
コード長 435 bytes
コンパイル時間 193 ms
コンパイル使用メモリ 82,312 KB
実行使用メモリ 53,692 KB
最終ジャッジ日時 2024-04-15 10:13:42
合計ジャッジ時間 2,053 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
52,452 KB
testcase_01 AC 38 ms
53,176 KB
testcase_02 AC 39 ms
52,000 KB
testcase_03 AC 39 ms
53,432 KB
testcase_04 AC 39 ms
52,268 KB
testcase_05 AC 39 ms
52,132 KB
testcase_06 AC 39 ms
53,636 KB
testcase_07 AC 43 ms
52,828 KB
testcase_08 AC 39 ms
52,204 KB
testcase_09 AC 38 ms
53,692 KB
testcase_10 AC 38 ms
52,884 KB
testcase_11 AC 38 ms
52,880 KB
testcase_12 AC 38 ms
53,428 KB
testcase_13 AC 39 ms
53,308 KB
testcase_14 AC 38 ms
53,168 KB
testcase_15 AC 39 ms
52,028 KB
testcase_16 AC 38 ms
52,512 KB
testcase_17 AC 39 ms
52,884 KB
testcase_18 AC 39 ms
52,400 KB
testcase_19 AC 39 ms
53,468 KB
testcase_20 AC 40 ms
52,592 KB
testcase_21 AC 39 ms
52,744 KB
testcase_22 AC 39 ms
52,140 KB
testcase_23 AC 39 ms
52,548 KB
testcase_24 AC 44 ms
52,992 KB
testcase_25 AC 39 ms
52,956 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

# あと最低C-num[4]枚欲しい...
print(num[4] + (C-num[4]+4)//5 * 5)
0