結果

問題 No.2681 ゲームセンターの両替
ユーザー hato336hato336
提出日時 2024-03-20 21:46:57
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 180 ms / 2,000 ms
コード長 704 bytes
コンパイル時間 212 ms
コンパイル使用メモリ 82,168 KB
実行使用メモリ 89,612 KB
最終ジャッジ日時 2024-04-15 10:13:17
合計ジャッジ時間 4,972 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 134 ms
85,628 KB
testcase_01 AC 137 ms
85,912 KB
testcase_02 AC 137 ms
85,856 KB
testcase_03 AC 132 ms
85,728 KB
testcase_04 AC 162 ms
89,612 KB
testcase_05 AC 136 ms
85,800 KB
testcase_06 AC 163 ms
89,552 KB
testcase_07 AC 151 ms
89,352 KB
testcase_08 AC 166 ms
89,484 KB
testcase_09 AC 161 ms
89,352 KB
testcase_10 AC 136 ms
85,740 KB
testcase_11 AC 160 ms
89,488 KB
testcase_12 AC 135 ms
85,784 KB
testcase_13 AC 134 ms
85,644 KB
testcase_14 AC 134 ms
85,944 KB
testcase_15 AC 133 ms
85,848 KB
testcase_16 AC 137 ms
85,584 KB
testcase_17 AC 132 ms
85,932 KB
testcase_18 AC 135 ms
85,800 KB
testcase_19 AC 133 ms
85,780 KB
testcase_20 AC 132 ms
85,636 KB
testcase_21 AC 133 ms
85,568 KB
testcase_22 AC 180 ms
89,548 KB
testcase_23 AC 134 ms
85,748 KB
testcase_24 AC 135 ms
85,712 KB
testcase_25 AC 132 ms
85,596 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import collections,sys,math,functools,operator,itertools,bisect,heapq,decimal,string,time,random
#sys.setrecursionlimit(10**9)
#sys.set_int_max_str_digits(0)
input = sys.stdin.readline
c,y = map(int,input().split())
if y // 100 < c:
    exit(print('can\'t exchange'))
d = collections.defaultdict(int)
z = [1,5,10,50,100,500,1000,2000,5000,10000]
for i in reversed(z):
    d[i] = y // i
    y %= i
if d[100] >= c:
    exit(print('no exchange'))
while d[100] < c:
    d[100] += 5
exit(print(d[100]))
ans = 0
now = d[100]
for i in reversed(z):
    if i <= 100:
        break
    if now >= c:
        break
    while d[i] > 0 and now < c:
        now += i // 100
        d[i] -= 1
        ans += 1
print(ans)
0