結果

問題 No.636 硬貨の枚数2
ユーザー fumofumofunifumofumofuni
提出日時 2022-02-14 23:29:44
言語 PyPy3
(7.3.15)
結果
RE  
(最新)
AC  
(最初)
実行時間 -
コード長 492 bytes
コンパイル時間 887 ms
コンパイル使用メモリ 86,712 KB
実行使用メモリ 78,768 KB
最終ジャッジ日時 2023-09-11 16:49:39
合計ジャッジ時間 11,269 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 79 ms
75,400 KB
testcase_01 AC 78 ms
75,596 KB
testcase_02 AC 79 ms
75,472 KB
testcase_03 AC 79 ms
75,560 KB
testcase_04 AC 80 ms
75,644 KB
testcase_05 AC 80 ms
75,480 KB
testcase_06 AC 80 ms
75,516 KB
testcase_07 AC 80 ms
75,720 KB
testcase_08 AC 79 ms
75,680 KB
testcase_09 AC 79 ms
75,400 KB
testcase_10 AC 79 ms
75,628 KB
testcase_11 AC 80 ms
75,572 KB
testcase_12 AC 79 ms
75,748 KB
testcase_13 AC 78 ms
75,712 KB
testcase_14 AC 77 ms
75,472 KB
testcase_15 AC 78 ms
75,500 KB
testcase_16 AC 79 ms
75,728 KB
testcase_17 AC 82 ms
75,668 KB
testcase_18 AC 81 ms
75,672 KB
testcase_19 AC 79 ms
75,480 KB
testcase_20 AC 79 ms
75,672 KB
testcase_21 AC 79 ms
75,520 KB
testcase_22 AC 78 ms
75,724 KB
testcase_23 AC 81 ms
75,544 KB
testcase_24 AC 114 ms
75,636 KB
testcase_25 RE -
testcase_26 AC 88 ms
75,552 KB
testcase_27 AC 116 ms
76,256 KB
testcase_28 AC 91 ms
75,728 KB
testcase_29 RE -
testcase_30 AC 90 ms
75,840 KB
testcase_31 RE -
testcase_32 AC 92 ms
75,712 KB
testcase_33 AC 85 ms
75,984 KB
testcase_34 RE -
testcase_35 RE -
testcase_36 RE -
testcase_37 RE -
testcase_38 RE -
testcase_39 RE -
testcase_40 RE -
testcase_41 RE -
testcase_42 RE -
testcase_43 RE -
testcase_44 RE -
testcase_45 RE -
testcase_46 RE -
testcase_47 RE -
testcase_48 RE -
testcase_49 RE -
testcase_50 RE -
testcase_51 RE -
testcase_52 RE -
testcase_53 RE -
testcase_54 AC 78 ms
75,536 KB
testcase_55 AC 79 ms
75,500 KB
testcase_56 AC 79 ms
75,444 KB
testcase_57 AC 79 ms
75,768 KB
testcase_58 AC 77 ms
75,580 KB
testcase_59 AC 79 ms
75,580 KB
testcase_60 AC 81 ms
75,636 KB
testcase_61 AC 78 ms
75,716 KB
testcase_62 AC 79 ms
75,500 KB
testcase_63 AC 79 ms
75,440 KB
testcase_64 RE -
testcase_65 RE -
testcase_66 RE -
testcase_67 RE -
testcase_68 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

N=int(input())
inf=1000000000000
dp0=0
dp1=inf
for i in range(20010):
    ndp0=inf
    ndp1=inf
    if i%2==0:
        rem=N%5
        ndp0=min(ndp0,dp0+rem)
        ndp0=min(ndp0,dp1+rem+1)
        ndp1=min(ndp1,dp0+5-rem)
        ndp1=min(ndp1,dp1+5-(rem+1))
        N=N//5
    else :
        rem=N%2
        ndp0=min(ndp0,dp0+rem)
        ndp0=min(ndp0,dp1+rem+1)
        ndp1=min(ndp1,dp0+2-rem)
        ndp1=min(ndp1,dp1+2-(rem+1))
        N=N//2
    dp0=ndp0
    dp1=ndp1
print(dp0)



0