結果

問題 No.2688 Cell Proliferation (Hard)
ユーザー ma_twma_tw
提出日時 2023-12-06 19:44:11
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
MLE  
(最新)
AC  
(最初)
実行時間 -
コード長 682 bytes
コンパイル時間 2,126 ms
コンパイル使用メモリ 208,736 KB
実行使用メモリ 814,848 KB
最終ジャッジ日時 2024-03-20 20:14:54
合計ジャッジ時間 3,635 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,548 KB
testcase_01 AC 25 ms
7,552 KB
testcase_02 AC 2 ms
6,548 KB
testcase_03 MLE -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#include <atcoder/modint>
using mint = atcoder::modint998244353;

int main() {
    int p1, p2, q1, q2, t;
    cin >> p1 >> p2 >> q1 >> q2 >> t;
    vector dp(t + 1, vector<mint> (t + 1));
    mint p = mint(p1) / p2;
    mint q = mint(q1) / q2;
    dp[0][0] = 1;
    for (int i = 0; i < t; i++) {
        mint sm = 0;
        for (int j = 0; j <= i; j++) {
            sm += dp[i][j];
        }
        dp[i + 1][0] = sm * p;
        for (int j = 0; j <= i; j++) {
            dp[i + 1][j + 1] = q.pow(j + 1) * dp[i][j];
        }
    }
    mint ans = 0;
    for (int j = 0; j <= t; j++) ans += dp[t][j];
    cout << ans.val() << endl;
}
0