結果
問題 |
No.555 世界史のレポート
|
ユーザー |
|
提出日時 | 2020-06-20 09:33:29 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 5 ms / 2,000 ms |
コード長 | 422 bytes |
コンパイル時間 | 2,031 ms |
コンパイル使用メモリ | 194,292 KB |
最終ジャッジ日時 | 2025-01-11 08:32:51 |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 20 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:11:25: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 11 | int n,c,v; scanf("%d%d%d",&n,&c,&v); | ~~~~~^~~~~~~~~~~~~~~~~~~
ソースコード
#include <bits/stdc++.h> #define rep(i,n) for(int i=0;i<(n);i++) using namespace std; using lint=long long; const long long INF=1LL<<61; int main(){ int n,c,v; scanf("%d%d%d",&n,&c,&v); vector<lint> dp(2*n+1,INF); dp[1]=0; for(int i=1;i<=2*n;i++){ lint cost=c; for(int j=2*i;j<=2*n;j+=i){ cost+=v; dp[j]=min(dp[j],dp[i]+cost); } } printf("%lld\n",*min_element(dp.begin()+n,dp.end())); return 0; }