結果

問題 No.555 世界史のレポート
ユーザー Navier_BoltzmannNavier_Boltzmann
提出日時 2022-09-28 06:44:14
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 124 ms / 2,000 ms
コード長 413 bytes
コンパイル時間 281 ms
コンパイル使用メモリ 87,248 KB
実行使用メモリ 78,808 KB
最終ジャッジ日時 2023-08-24 04:15:19
合計ジャッジ時間 3,390 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,320 KB
testcase_01 AC 73 ms
71,388 KB
testcase_02 AC 72 ms
71,384 KB
testcase_03 AC 86 ms
76,488 KB
testcase_04 AC 88 ms
76,024 KB
testcase_05 AC 90 ms
76,380 KB
testcase_06 AC 92 ms
76,420 KB
testcase_07 AC 90 ms
76,452 KB
testcase_08 AC 92 ms
76,404 KB
testcase_09 AC 96 ms
76,208 KB
testcase_10 AC 117 ms
78,680 KB
testcase_11 AC 118 ms
77,940 KB
testcase_12 AC 117 ms
78,024 KB
testcase_13 AC 115 ms
78,248 KB
testcase_14 AC 118 ms
78,220 KB
testcase_15 AC 118 ms
78,032 KB
testcase_16 AC 113 ms
78,188 KB
testcase_17 AC 117 ms
78,420 KB
testcase_18 AC 124 ms
78,808 KB
testcase_19 AC 122 ms
78,092 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
C,V = map(int,input().split())

INF = (1<<30)

dp = [INF]*(N+2)
def f(x):
    return min(x,N+1)

dp[1]=0
for i in range(1,N+1):
    
    for j in range(2*i,N+i,i):
        dp[f(j)] = min(dp[f(j)],dp[i] + (j-i)//i*V + C)
    
    cnt = 1
    j = i
    while j<N:
        dp[f(2*j)] = min(dp[f(2*j)],dp[i]+cnt*(C+V))
        cnt += 1
        j *= 2
        
ans = min(dp[N],dp[N+1])
print(ans)
    
0