結果

問題 No.2580 Hyperinflation
ユーザー noshi91noshi91
提出日時 2023-03-29 02:39:33
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 576 bytes
コンパイル時間 2,066 ms
コンパイル使用メモリ 204,196 KB
実行使用メモリ 6,960 KB
最終ジャッジ日時 2023-10-28 03:49:11
合計ジャッジ時間 5,454 ms
ジャッジサーバーID
(参考情報)
judge10 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 19 ms
6,764 KB
testcase_03 AC 15 ms
5,972 KB
testcase_04 AC 9 ms
4,652 KB
testcase_05 AC 10 ms
6,960 KB
testcase_06 AC 2 ms
4,348 KB
testcase_07 AC 15 ms
5,972 KB
testcase_08 AC 4 ms
4,348 KB
testcase_09 AC 8 ms
5,972 KB
testcase_10 AC 5 ms
4,348 KB
testcase_11 AC 14 ms
5,708 KB
testcase_12 AC 10 ms
6,500 KB
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 RE -
testcase_20 RE -
testcase_21 RE -
testcase_22 RE -
testcase_23 RE -
testcase_24 RE -
testcase_25 RE -
testcase_26 RE -
testcase_27 RE -
testcase_28 RE -
testcase_29 RE -
testcase_30 RE -
testcase_31 RE -
testcase_32 RE -
testcase_33 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

constexpr int mod = 998244353;

int main() {
  int N;
  std::cin >> N;
  std::vector<int> B(N);
  B[0] = 1;
  for (int i = 1; i < N; i++) {
    std::cin >> B[i];
    B[i] *= B[i - 1];
    if (B[i] > 1000000)
      std::abort();
  }

  std::string M_;
  std::cin >> M_;
  if (M_.size() >= 8)
    std::abort();
  const int M = std::stoi(M_);

  std::vector<int> dp(M + 1, 0);
  dp[0] = 1;
  for (const int e : B) {
    for (int i = e; i <= M; i++) {
      dp[i] += dp[i - e];
      dp[i] %= mod;
    }
  }

  std::cout << dp[M] << "\n";

  return 0;
}
0