結果

問題 No.2681 ゲームセンターの両替
ユーザー lloyzlloyz
提出日時 2024-04-12 00:09:04
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 34 ms / 2,000 ms
コード長 491 bytes
コンパイル時間 101 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-04-15 10:14:16
合計ジャッジ時間 1,738 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 33 ms
10,880 KB
testcase_01 AC 34 ms
10,752 KB
testcase_02 AC 30 ms
10,752 KB
testcase_03 AC 31 ms
10,752 KB
testcase_04 AC 30 ms
10,752 KB
testcase_05 AC 30 ms
10,752 KB
testcase_06 AC 31 ms
10,752 KB
testcase_07 AC 31 ms
10,752 KB
testcase_08 AC 31 ms
10,752 KB
testcase_09 AC 31 ms
10,752 KB
testcase_10 AC 31 ms
10,880 KB
testcase_11 AC 34 ms
10,880 KB
testcase_12 AC 31 ms
10,752 KB
testcase_13 AC 31 ms
10,880 KB
testcase_14 AC 33 ms
10,752 KB
testcase_15 AC 30 ms
10,752 KB
testcase_16 AC 32 ms
10,752 KB
testcase_17 AC 30 ms
10,752 KB
testcase_18 AC 30 ms
10,752 KB
testcase_19 AC 33 ms
10,752 KB
testcase_20 AC 33 ms
10,752 KB
testcase_21 AC 30 ms
10,752 KB
testcase_22 AC 30 ms
10,752 KB
testcase_23 AC 31 ms
10,752 KB
testcase_24 AC 30 ms
10,752 KB
testcase_25 AC 31 ms
10,880 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

c, y = map(int, input().split())

if y < 100 * c:
    print("can't exchange")
    exit()
C = dict()
L = [10000, 5000, 2000, 1000, 500, 100, 50, 10, 5, 1]
for n in L:
    r, y = divmod(y, n)
    C[n] = r
if C[100] >= c:
    print("no exchange")
    exit()
yy = 0
LL = [100, 500, 1000, 2000, 5000, 10000]
for n in LL:
    yy += n * C[n]
if yy < 100 * c:
    print("can't exchange")
else:
    ans = c
    yy -= c * 100
    while yy % 500 != 0:
        ans += 1
        yy -= 100
    print(ans)
0