結果

問題 No.2681 ゲームセンターの両替
ユーザー pitPpitP
提出日時 2024-03-20 21:16:06
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 45 ms / 2,000 ms
コード長 351 bytes
コンパイル時間 209 ms
コンパイル使用メモリ 82,256 KB
実行使用メモリ 53,976 KB
最終ジャッジ日時 2024-04-15 10:11:42
合計ジャッジ時間 2,098 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
52,676 KB
testcase_01 AC 40 ms
52,632 KB
testcase_02 AC 39 ms
52,560 KB
testcase_03 AC 39 ms
52,276 KB
testcase_04 AC 39 ms
53,012 KB
testcase_05 AC 40 ms
53,292 KB
testcase_06 AC 40 ms
52,324 KB
testcase_07 AC 45 ms
52,436 KB
testcase_08 AC 40 ms
52,120 KB
testcase_09 AC 40 ms
51,936 KB
testcase_10 AC 40 ms
52,960 KB
testcase_11 AC 39 ms
52,884 KB
testcase_12 AC 40 ms
53,356 KB
testcase_13 AC 40 ms
52,680 KB
testcase_14 AC 39 ms
53,976 KB
testcase_15 AC 40 ms
52,556 KB
testcase_16 AC 41 ms
53,012 KB
testcase_17 AC 41 ms
52,356 KB
testcase_18 AC 39 ms
53,188 KB
testcase_19 AC 41 ms
52,636 KB
testcase_20 AC 39 ms
53,436 KB
testcase_21 AC 40 ms
52,632 KB
testcase_22 AC 40 ms
53,308 KB
testcase_23 AC 40 ms
52,956 KB
testcase_24 AC 41 ms
52,188 KB
testcase_25 AC 43 ms
52,064 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

C, Y = map(int, input().split())
if C * 100 > Y:
    exit(print("can't exchange"))

N = 10
cnt500 = Y // 500
Y %= 500
cnt100 = Y // 100

if cnt100 >= C:
    exit(print("no exchange"))

ok = cnt500; ng = 0
while abs(ok - ng) > 1:
    mid = (ok + ng) // 2
    if mid * 5 + cnt100 >= C:
        ok = mid
    else:
        ng = mid

print(ok * 5 + cnt100)
0