結果
| 問題 |
No.555 世界史のレポート
|
| ユーザー |
|
| 提出日時 | 2017-08-11 22:50:37 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 2,000 ms |
| コード長 | 441 bytes |
| コンパイル時間 | 1,329 ms |
| コンパイル使用メモリ | 157,400 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-12 21:33:55 |
| 合計ジャッジ時間 | 1,904 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 20 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:12:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
12 | scanf("%d",&n);
| ~~~~~^~~~~~~~~
main.cpp:13:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
13 | scanf("%lld%lld",&c,&v);
| ~~~~~^~~~~~~~~~~~~~~~~~
ソースコード
#include <bits/stdc++.h>
#define INF 1000000000007LL
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int n;
ll dp[50001];
ll c,v;
int main(void){
scanf("%d",&n);
scanf("%lld%lld",&c,&v);
for(int i=0;i<=n;i++){
dp[i]=INF;
}
dp[1]=0;
for(int i=1;i<n;i++){
ll num=1;
for(int j=i+i;;j+=i){
dp[min(j,n)]=min(dp[min(j,n)],dp[i]+c+v*num);
if(j>=n)break;
num++;
}
}
printf("%lld\n",dp[n]);
return 0;
}