結果

問題 No.664 超能力者Aと株価予測
ユーザー 👑 はまやんはまやんはまやんはまやん
提出日時 2018-03-10 22:06:13
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,758 bytes
コンパイル時間 2,021 ms
コンパイル使用メモリ 163,592 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-22 18:28:06
合計ジャッジ時間 2,506 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 WA -
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 2 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
            ∧_∧  
      ∧_∧  (´<_` )  Welcome to My Coding Space!
     ( ´_ゝ`) /  ⌒i     
    /   \     | |     
    /   / ̄ ̄ ̄ ̄/  |  
  __(__ニつ/     _/ .| .|____  
     \/____/ (u ⊃  
---------------------------------------------------------------------------------------------------*/





int N, M, K, A[401];
ll dp[30][401];
//---------------------------------------------------------------------------------------------------
void _main() {
    cin >> N >> M >> K;
    N++;
    rep(i, 0, N) cin >> A[i];

    dp[0][0] = K;
    rep(m, 1, M + 1) rep(n, 0, N) {
        rep(i, 0, n) {
            ll d = dp[m - 1][i] / A[i];
            ll c = dp[m - 1][i] % A[i] + d * A[n];
            chmax(dp[m][n], c);
        }
    }

    ll ans = 0;
    rep(m, 0, M + 1) rep(n, 0, N) chmax(ans, dp[m][n]);
    cout << ans << endl;
}
0