結果

問題 No.555 世界史のレポート
ユーザー tnakao0123tnakao0123
提出日時 2017-08-13 22:56:31
言語 C++11
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 869 bytes
コンパイル時間 658 ms
コンパイル使用メモリ 84,888 KB
実行使用メモリ 14,008 KB
最終ジャッジ日時 2024-04-21 10:32:32
合計ジャッジ時間 22,403 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
10,144 KB
testcase_01 AC 2 ms
6,940 KB
testcase_02 AC 2 ms
6,944 KB
testcase_03 AC 2 ms
6,944 KB
testcase_04 AC 2 ms
6,940 KB
testcase_05 AC 3 ms
6,940 KB
testcase_06 AC 2 ms
6,940 KB
testcase_07 AC 3 ms
6,944 KB
testcase_08 AC 3 ms
6,940 KB
testcase_09 AC 3 ms
6,940 KB
testcase_10 AC 1,883 ms
6,940 KB
testcase_11 TLE -
testcase_12 AC 1,846 ms
6,944 KB
testcase_13 AC 1,424 ms
6,940 KB
testcase_14 TLE -
testcase_15 TLE -
testcase_16 AC 1,653 ms
6,940 KB
testcase_17 AC 1,982 ms
6,940 KB
testcase_18 TLE -
testcase_19 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

/* -*- coding: utf-8 -*-
 *
 * 555.cc: No.555 世界史のレポート - yukicoder
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int MAX_N = 50000;
const int INF = 1 << 30;

/* typedef */

/* global variables */

int dp[MAX_N + 1];

/* subroutines */

/* main */

int main() {
  int n, c, v;
  cin >> n >> c >> v;

  dp[1] = 0;
  for (int i = 2; i <= n; i++) {
    int mind = INF;
    for (int j = 1; j < i; j++) {
      int d = dp[j] + c + (i - 1) / j * v;
      if (mind > d) mind = d;
    }
    dp[i] = mind;
  }

  printf("%d\n", dp[n]);
  return 0;
}
0