結果

問題 No.636 硬貨の枚数2
ユーザー convexineqconvexineq
提出日時 2021-02-26 04:23:53
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 547 bytes
コンパイル時間 298 ms
コンパイル使用メモリ 82,316 KB
実行使用メモリ 76,468 KB
最終ジャッジ日時 2024-04-09 19:30:31
合計ジャッジ時間 4,793 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
52,364 KB
testcase_01 AC 31 ms
52,396 KB
testcase_02 AC 30 ms
53,140 KB
testcase_03 AC 32 ms
52,244 KB
testcase_04 WA -
testcase_05 AC 29 ms
53,216 KB
testcase_06 WA -
testcase_07 AC 29 ms
53,052 KB
testcase_08 AC 29 ms
53,036 KB
testcase_09 WA -
testcase_10 AC 29 ms
52,272 KB
testcase_11 AC 30 ms
52,196 KB
testcase_12 AC 30 ms
52,012 KB
testcase_13 WA -
testcase_14 AC 30 ms
52,484 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 30 ms
52,136 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
testcase_42 WA -
testcase_43 WA -
testcase_44 WA -
testcase_45 WA -
testcase_46 WA -
testcase_47 WA -
testcase_48 WA -
testcase_49 WA -
testcase_50 WA -
testcase_51 WA -
testcase_52 WA -
testcase_53 WA -
testcase_54 AC 30 ms
53,504 KB
testcase_55 AC 30 ms
52,004 KB
testcase_56 AC 30 ms
52,068 KB
testcase_57 AC 30 ms
52,000 KB
testcase_58 AC 31 ms
52,692 KB
testcase_59 AC 30 ms
52,480 KB
testcase_60 AC 32 ms
52,860 KB
testcase_61 AC 30 ms
52,492 KB
testcase_62 WA -
testcase_63 AC 29 ms
52,204 KB
testcase_64 AC 36 ms
60,416 KB
testcase_65 AC 37 ms
62,188 KB
testcase_66 AC 36 ms
60,964 KB
testcase_67 AC 39 ms
62,132 KB
testcase_68 AC 37 ms
61,344 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

s = "0"+input()
n = len(s)
leq = INF = 1<<30
mor = 0
for i in map(int,s[::-1]):
    nleq = nmor = INF
    if i <=9: nmor = min(nmor, mor + i)
    if i > 0: nleq = min(nleq, mor + (10-i if i >= 5 else 1+5-i))
    if i >=5: nleq = min(nleq, mor + 1 + i-5)
    if i <=5: nmor = min(nmor, mor + 1 + (5-i))
    i += 1
    if i <=9: nmor = min(nmor, leq + i)
    if i > 0: nleq = min(nleq, leq + (10-i if i >= 5 else 1+5-i))
    if i >=5: nleq = min(nleq, leq + 1 + i-5)
    if i <=5: nmor = min(nmor, leq + 1 + (5-i))
    leq,mor = nleq,nmor
print(mor)
0