結果

問題 No.1737 One to N
ユーザー roarisroaris
提出日時 2021-11-12 21:34:30
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 188 ms / 2,000 ms
コード長 220 bytes
コンパイル時間 332 ms
コンパイル使用メモリ 87,124 KB
実行使用メモリ 80,196 KB
最終ジャッジ日時 2023-08-17 00:11:32
合計ジャッジ時間 6,351 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 188 ms
80,064 KB
testcase_01 AC 91 ms
71,448 KB
testcase_02 AC 117 ms
78,172 KB
testcase_03 AC 91 ms
71,724 KB
testcase_04 AC 108 ms
78,068 KB
testcase_05 AC 179 ms
80,196 KB
testcase_06 AC 181 ms
79,820 KB
testcase_07 AC 173 ms
79,496 KB
testcase_08 AC 113 ms
77,980 KB
testcase_09 AC 114 ms
77,908 KB
testcase_10 AC 135 ms
78,620 KB
testcase_11 AC 111 ms
77,628 KB
testcase_12 AC 126 ms
78,240 KB
testcase_13 AC 140 ms
78,812 KB
testcase_14 AC 159 ms
79,324 KB
testcase_15 AC 165 ms
79,364 KB
testcase_16 AC 133 ms
78,328 KB
testcase_17 AC 133 ms
78,412 KB
testcase_18 AC 132 ms
78,656 KB
testcase_19 AC 110 ms
77,500 KB
testcase_20 AC 112 ms
77,964 KB
testcase_21 AC 150 ms
79,072 KB
testcase_22 AC 112 ms
77,916 KB
testcase_23 AC 151 ms
79,032 KB
testcase_24 AC 138 ms
78,908 KB
testcase_25 AC 125 ms
78,360 KB
testcase_26 AC 115 ms
78,072 KB
testcase_27 AC 94 ms
71,904 KB
testcase_28 AC 136 ms
78,676 KB
testcase_29 AC 92 ms
71,656 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline
from collections import *

N = int(input())
dp = [10**18]*(N+1)
dp[1] = 0

for i in range(1, N):
    for j in range(2*i, N+1, i):
        dp[j] = min(dp[j], dp[i]+j//i)

print(dp[N])
0