結果

問題 No.1737 One to N
ユーザー roarisroaris
提出日時 2021-11-12 21:34:30
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 128 ms / 2,000 ms
コード長 220 bytes
コンパイル時間 132 ms
コンパイル使用メモリ 82,096 KB
実行使用メモリ 78,572 KB
最終ジャッジ日時 2024-05-04 07:34:42
合計ジャッジ時間 3,230 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 125 ms
78,260 KB
testcase_01 AC 36 ms
53,356 KB
testcase_02 AC 57 ms
66,392 KB
testcase_03 AC 41 ms
54,112 KB
testcase_04 AC 53 ms
65,300 KB
testcase_05 AC 122 ms
78,356 KB
testcase_06 AC 128 ms
78,572 KB
testcase_07 AC 122 ms
76,100 KB
testcase_08 AC 55 ms
65,664 KB
testcase_09 AC 58 ms
65,476 KB
testcase_10 AC 76 ms
69,900 KB
testcase_11 AC 54 ms
64,904 KB
testcase_12 AC 66 ms
67,744 KB
testcase_13 AC 81 ms
70,464 KB
testcase_14 AC 99 ms
74,200 KB
testcase_15 AC 105 ms
75,864 KB
testcase_16 AC 68 ms
69,836 KB
testcase_17 AC 72 ms
70,108 KB
testcase_18 AC 74 ms
69,812 KB
testcase_19 AC 51 ms
64,572 KB
testcase_20 AC 52 ms
66,232 KB
testcase_21 AC 91 ms
72,756 KB
testcase_22 AC 53 ms
64,416 KB
testcase_23 AC 88 ms
73,784 KB
testcase_24 AC 79 ms
70,696 KB
testcase_25 AC 66 ms
68,456 KB
testcase_26 AC 56 ms
66,748 KB
testcase_27 AC 38 ms
53,832 KB
testcase_28 AC 73 ms
70,956 KB
testcase_29 AC 37 ms
54,280 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