結果

問題 No.555 世界史のレポート
ユーザー Navier_BoltzmannNavier_Boltzmann
提出日時 2022-09-28 06:43:21
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 413 bytes
コンパイル時間 285 ms
コンパイル使用メモリ 87,196 KB
実行使用メモリ 78,700 KB
最終ジャッジ日時 2023-08-24 04:15:15
合計ジャッジ時間 4,649 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,236 KB
testcase_01 AC 68 ms
71,364 KB
testcase_02 AC 69 ms
71,384 KB
testcase_03 AC 81 ms
76,200 KB
testcase_04 AC 78 ms
75,888 KB
testcase_05 AC 82 ms
76,536 KB
testcase_06 WA -
testcase_07 AC 84 ms
76,808 KB
testcase_08 AC 87 ms
76,832 KB
testcase_09 AC 89 ms
76,604 KB
testcase_10 AC 110 ms
77,836 KB
testcase_11 AC 112 ms
78,112 KB
testcase_12 AC 111 ms
77,628 KB
testcase_13 AC 112 ms
77,764 KB
testcase_14 WA -
testcase_15 AC 118 ms
77,816 KB
testcase_16 AC 112 ms
77,888 KB
testcase_17 AC 113 ms
77,780 KB
testcase_18 AC 120 ms
78,700 KB
testcase_19 AC 114 ms
77,992 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+1,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