結果

問題 No.1737 One to N
ユーザー ShirotsumeShirotsume
提出日時 2021-10-11 21:35:36
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 74 ms / 2,000 ms
コード長 218 bytes
コンパイル時間 169 ms
コンパイル使用メモリ 82,408 KB
実行使用メモリ 78,032 KB
最終ジャッジ日時 2024-05-04 04:04:16
合計ジャッジ時間 2,697 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
77,796 KB
testcase_01 AC 34 ms
55,800 KB
testcase_02 AC 46 ms
66,480 KB
testcase_03 AC 34 ms
54,244 KB
testcase_04 AC 43 ms
65,204 KB
testcase_05 AC 72 ms
78,032 KB
testcase_06 AC 70 ms
77,856 KB
testcase_07 AC 65 ms
76,020 KB
testcase_08 AC 43 ms
64,616 KB
testcase_09 AC 46 ms
65,800 KB
testcase_10 AC 52 ms
69,548 KB
testcase_11 AC 43 ms
65,700 KB
testcase_12 AC 46 ms
68,396 KB
testcase_13 AC 53 ms
69,968 KB
testcase_14 AC 60 ms
73,888 KB
testcase_15 AC 66 ms
75,468 KB
testcase_16 AC 52 ms
69,196 KB
testcase_17 AC 54 ms
70,056 KB
testcase_18 AC 52 ms
69,332 KB
testcase_19 AC 42 ms
65,096 KB
testcase_20 AC 43 ms
65,180 KB
testcase_21 AC 57 ms
72,656 KB
testcase_22 AC 44 ms
65,044 KB
testcase_23 AC 57 ms
72,396 KB
testcase_24 AC 52 ms
70,816 KB
testcase_25 AC 48 ms
67,612 KB
testcase_26 AC 44 ms
66,428 KB
testcase_27 AC 32 ms
54,216 KB
testcase_28 AC 51 ms
69,264 KB
testcase_29 AC 33 ms
54,492 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
INF = 10 ** 18
dp = [INF] * 300010
dp[1] = 0
for i in range(1, n + 1):
    for k in range(1, n + 1):
        if i * k > n:
            break
        dp[i * k] = min(dp[i] + k, dp[i * k])
print(dp[n])

0