結果

問題 No.2681 ゲームセンターの両替
ユーザー lloyz
提出日時 2024-04-12 00:09:04
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 27 ms / 2,000 ms
コード長 491 bytes
コンパイル時間 72 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 10,752 KB
最終ジャッジ日時 2024-10-05 04:16:50
合計ジャッジ時間 1,442 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

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