結果

問題 No.2681 ゲームセンターの両替
ユーザー nikoro256nikoro256
提出日時 2024-03-21 23:50:32
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 56 ms / 2,000 ms
コード長 407 bytes
コンパイル時間 217 ms
コンパイル使用メモリ 81,816 KB
実行使用メモリ 59,488 KB
最終ジャッジ日時 2024-04-15 10:13:59
合計ジャッジ時間 2,530 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 48 ms
52,776 KB
testcase_01 AC 46 ms
52,128 KB
testcase_02 AC 46 ms
52,144 KB
testcase_03 AC 52 ms
57,780 KB
testcase_04 AC 56 ms
59,052 KB
testcase_05 AC 52 ms
58,028 KB
testcase_06 AC 52 ms
59,264 KB
testcase_07 AC 51 ms
58,340 KB
testcase_08 AC 52 ms
58,544 KB
testcase_09 AC 52 ms
58,028 KB
testcase_10 AC 50 ms
59,412 KB
testcase_11 AC 51 ms
58,084 KB
testcase_12 AC 53 ms
59,488 KB
testcase_13 AC 45 ms
52,316 KB
testcase_14 AC 45 ms
52,836 KB
testcase_15 AC 43 ms
52,560 KB
testcase_16 AC 46 ms
53,136 KB
testcase_17 AC 52 ms
58,192 KB
testcase_18 AC 54 ms
57,888 KB
testcase_19 AC 53 ms
59,304 KB
testcase_20 AC 50 ms
52,492 KB
testcase_21 AC 48 ms
51,944 KB
testcase_22 AC 51 ms
58,004 KB
testcase_23 AC 45 ms
52,704 KB
testcase_24 AC 45 ms
52,360 KB
testcase_25 AC 51 ms
58,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

C,Y=map(int,input().split())
keta=[1,5,10,50,100,500,1000,2000,5000,10000]
count=[0]*10
for i in range(9,-1,-1):
    count[i]=Y//keta[i]
    Y-=keta[i]*count[i]
if count[4]>=C:
    print('no exchange')
    exit(0)
all=0
ans=0
for i in range(9,4,-1):
    for j in range(count[i]):
        all+=keta[i]//keta[4]
if C<=all+count[4]:
    print(count[4]-(-(C-count[4])//5)*5)
    exit(0)
print('can\'t exchange')
0