結果

問題 No.2681 ゲームセンターの両替
ユーザー 👑 p-adicp-adic
提出日時 2024-03-20 22:13:42
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 44 ms / 2,000 ms
コード長 327 bytes
コンパイル時間 155 ms
コンパイル使用メモリ 82,264 KB
実行使用メモリ 53,944 KB
最終ジャッジ日時 2024-04-15 10:13:25
合計ジャッジ時間 2,084 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
52,200 KB
testcase_01 AC 41 ms
52,372 KB
testcase_02 AC 39 ms
52,964 KB
testcase_03 AC 40 ms
53,024 KB
testcase_04 AC 38 ms
53,944 KB
testcase_05 AC 39 ms
52,560 KB
testcase_06 AC 38 ms
52,864 KB
testcase_07 AC 44 ms
53,420 KB
testcase_08 AC 39 ms
52,344 KB
testcase_09 AC 39 ms
52,612 KB
testcase_10 AC 38 ms
52,436 KB
testcase_11 AC 39 ms
53,160 KB
testcase_12 AC 38 ms
52,856 KB
testcase_13 AC 38 ms
52,888 KB
testcase_14 AC 41 ms
52,408 KB
testcase_15 AC 39 ms
52,824 KB
testcase_16 AC 38 ms
52,256 KB
testcase_17 AC 39 ms
53,836 KB
testcase_18 AC 40 ms
52,528 KB
testcase_19 AC 40 ms
53,352 KB
testcase_20 AC 39 ms
52,688 KB
testcase_21 AC 39 ms
52,184 KB
testcase_22 AC 39 ms
52,976 KB
testcase_23 AC 38 ms
52,440 KB
testcase_24 AC 39 ms
52,812 KB
testcase_25 AC 38 ms
52,808 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

R=range
C,Y=map(int,input().split())
Y//=100
b=[5,10,20,50,100,11**9]
a=[Y%b[i+1]//b[i]*b[i]for i in R(5)]
c=d=e=Y%5
for n in[0,0]:
	for i in R(4,-1,-1):
		if d<C:
			if d+a[i]>C:d=C+(d+(C-d+b[i]-1)//b[i]*b[i]-C)%5
			else:d+=a[i]
	b[2],b[3],d,e=b[3],b[2],e,d
print("can't exchange"if Y<C else min(d,e)if c<C else"no exchange")
0