結果

問題 No.555 世界史のレポート
ユーザー beetbeet
提出日時 2017-08-11 22:30:57
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 11 ms / 2,000 ms
コード長 381 bytes
コンパイル時間 1,300 ms
コンパイル使用メモリ 144,260 KB
実行使用メモリ 5,104 KB
最終ジャッジ日時 2023-08-02 22:56:49
合計ジャッジ時間 2,337 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 10 ms
5,088 KB
testcase_01 AC 10 ms
5,036 KB
testcase_02 AC 10 ms
5,036 KB
testcase_03 AC 11 ms
5,040 KB
testcase_04 AC 11 ms
5,052 KB
testcase_05 AC 11 ms
4,980 KB
testcase_06 AC 11 ms
4,992 KB
testcase_07 AC 10 ms
5,036 KB
testcase_08 AC 10 ms
5,040 KB
testcase_09 AC 10 ms
5,040 KB
testcase_10 AC 11 ms
4,980 KB
testcase_11 AC 10 ms
5,040 KB
testcase_12 AC 11 ms
5,052 KB
testcase_13 AC 11 ms
4,984 KB
testcase_14 AC 11 ms
5,052 KB
testcase_15 AC 11 ms
4,996 KB
testcase_16 AC 10 ms
4,976 KB
testcase_17 AC 11 ms
5,032 KB
testcase_18 AC 11 ms
5,104 KB
testcase_19 AC 10 ms
5,064 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
#define int long long
#define MAX 214514
signed main(){
  int n,c,v;
  cin>>n>>c>>v;
  int dp[MAX];
  fill_n(dp,MAX,1LL<<55LL);
  dp[1]=0;
  for(int i=1;i<MAX;i++)
    for(int j=1;j<MAX/i;j++)
      dp[i+i*j]=min(dp[i+i*j],dp[i]+c+v*j);
  int ans=dp[n];
  for(int i=n;i<MAX;i++)
    ans=min(ans,dp[i]);
  cout<<ans<<endl;
  return 0;
}
0