結果

問題 No.555 世界史のレポート
ユーザー addeight2addeight2
提出日時 2016-08-30 15:12:15
言語 C++11
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 399 bytes
コンパイル時間 1,645 ms
コンパイル使用メモリ 158,056 KB
実行使用メモリ 13,880 KB
最終ジャッジ日時 2024-04-26 18:00:28
合計ジャッジ時間 7,677 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
8,704 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 3 ms
5,376 KB
testcase_06 AC 3 ms
5,376 KB
testcase_07 AC 3 ms
5,376 KB
testcase_08 AC 4 ms
5,376 KB
testcase_09 AC 4 ms
5,376 KB
testcase_10 TLE -
testcase_11 TLE -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,a) FOR(i,0,a)

const int MAX_N=50000;

int N;
int C,V;

int dp[MAX_N+1];

void solve(){
  dp[1]=0;
  FOR(i,2,N+1){
    dp[i]=C+(i-1)*V;
    FOR(j,2,i){
      dp[i]=min(dp[i],dp[j]+C+((i+j-1)/j-1)*V);
    }
  }
  cout<<dp[N]<<endl;
}

int main(){
  cin>>N;
  cin>>C>>V;
  solve();
  return 0;
}
0