結果
問題 | No.555 世界史のレポート |
ユーザー |
![]() |
提出日時 | 2017-11-30 09:24:01 |
言語 | D (dmd 2.109.1) |
結果 |
AC
|
実行時間 | 4 ms / 2,000 ms |
コード長 | 546 bytes |
コンパイル時間 | 669 ms |
コンパイル使用メモリ | 100,676 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-06-12 22:43:40 |
合計ジャッジ時間 | 1,478 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 20 |
ソースコード
void main(){import std.stdio, std.string, std.conv, std.algorithm;int n; rd(n);int c, v; rd(c, v);auto rec=new int[](3*n);fill(rec, 1_000_000_000);rec[0]=rec[1]=0;foreach(i; 1..n)for(int j=1; i*(1+j)<=n*2; j++){chmin(rec[i*(1+j)], rec[i]+c+v*j);}writeln(reduce!(min)(rec[n..(2*n+1)]));}void chmin(T)(ref T x, T y){if(x>y) x=y;}void rd(T...)(ref T x){import std.stdio, std.string, std.conv;auto l=readln.split;assert(l.length==x.length);foreach(i, ref e; x){e=l[i].to!(typeof(e));}}