結果

問題 No.1737 One to N
ユーザー 👑 KazunKazun
提出日時 2021-11-12 21:26:41
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 119 ms / 2,000 ms
コード長 171 bytes
コンパイル時間 277 ms
コンパイル使用メモリ 87,044 KB
実行使用メモリ 80,944 KB
最終ジャッジ日時 2023-08-16 21:27:15
合計ジャッジ時間 4,521 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 119 ms
80,944 KB
testcase_01 AC 71 ms
71,300 KB
testcase_02 AC 86 ms
76,908 KB
testcase_03 AC 71 ms
71,328 KB
testcase_04 AC 84 ms
76,636 KB
testcase_05 AC 118 ms
80,704 KB
testcase_06 AC 119 ms
80,800 KB
testcase_07 AC 115 ms
80,344 KB
testcase_08 AC 84 ms
76,696 KB
testcase_09 AC 85 ms
76,692 KB
testcase_10 AC 94 ms
78,036 KB
testcase_11 AC 84 ms
76,528 KB
testcase_12 AC 89 ms
77,400 KB
testcase_13 AC 97 ms
78,572 KB
testcase_14 AC 106 ms
79,300 KB
testcase_15 AC 111 ms
79,900 KB
testcase_16 AC 91 ms
77,656 KB
testcase_17 AC 94 ms
78,052 KB
testcase_18 AC 94 ms
77,976 KB
testcase_19 AC 83 ms
76,396 KB
testcase_20 AC 83 ms
76,588 KB
testcase_21 AC 102 ms
78,812 KB
testcase_22 AC 83 ms
76,644 KB
testcase_23 AC 101 ms
78,888 KB
testcase_24 AC 96 ms
78,396 KB
testcase_25 AC 90 ms
77,376 KB
testcase_26 AC 86 ms
76,832 KB
testcase_27 AC 70 ms
71,268 KB
testcase_28 AC 95 ms
78,264 KB
testcase_29 AC 71 ms
71,288 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N=int(input())

inf=float("inf")
DP=[inf]*(N+1); DP[1]=0

for i in range(1,N+1):
    k=2
    while k*i<=N:
        DP[k*i]=min(DP[k*i],DP[i]+k)
        k+=1

print(DP[N])
0