結果

問題 No.555 世界史のレポート
ユーザー pekempeypekempey
提出日時 2017-08-11 22:59:55
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 909 ms / 2,000 ms
コード長 418 bytes
コンパイル時間 915 ms
コンパイル使用メモリ 73,776 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-02 23:21:53
合計ジャッジ時間 7,464 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 3 ms
4,380 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 3 ms
4,376 KB
testcase_06 AC 3 ms
4,376 KB
testcase_07 AC 3 ms
4,376 KB
testcase_08 AC 3 ms
4,376 KB
testcase_09 AC 3 ms
4,376 KB
testcase_10 AC 528 ms
4,376 KB
testcase_11 AC 619 ms
4,376 KB
testcase_12 AC 520 ms
4,376 KB
testcase_13 AC 421 ms
4,380 KB
testcase_14 AC 587 ms
4,376 KB
testcase_15 AC 601 ms
4,380 KB
testcase_16 AC 473 ms
4,376 KB
testcase_17 AC 555 ms
4,376 KB
testcase_18 AC 629 ms
4,376 KB
testcase_19 AC 909 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <vector>
#include <string>

using namespace std;

long long n, c, v;

long long f(int len, int clip) {
  if (len >= n) return 0;
  clip = len;
  long long ret = (n - len + clip - 1) / clip * v;
  for (int i = 1; i < 20; i++) {
    ret = min(ret, f(len + clip * i, clip) + v * i);
  }
  return ret + c;
}

int main() {
  cin >> n >> c >> v;
  cout << f(1, 0) << endl;
}
0