結果
| 問題 |
No.555 世界史のレポート
|
| コンテスト | |
| ユーザー |
ei1333333
|
| 提出日時 | 2017-08-11 22:42:08 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 897 bytes |
| コンパイル時間 | 1,837 ms |
| コンパイル使用メモリ | 157,792 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-12 21:24:47 |
| 合計ジャッジ時間 | 2,044 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 6 WA * 14 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
typedef long long int64;
const int64 INF = 1LL << 60;
int main()
{
int N, C, V;
cin >> N >> C >> V;
int64 ret = INF;
for(int i = 1; i <= N; i++) {
int64 length = 1, cost = 0, add = 0;
for(int j = 0; j < i; j++) {
add = length;
cost += C;
length += add;
cost += V;
if(length >= N) break;
}
if(length >= N) ret = min(ret, cost);
else ret = min(ret, ((N - length) + (add - 1)) / add * V + cost);
}
for(int i = 0; i <= N; i++) {
int64 length = 1, cost = 0, add = 0;
for(int j = 0; j < i; j++) {
add = length;
cost += C;
length += add;
cost += V;
if(length >= N) break;
}
add = length;
cost += C;
if(length >= N) ret = min(ret, cost);
else ret = min(ret, ((N - length) + (add - 1)) / add * V + cost);
}
cout << ret << endl;
}
ei1333333