結果
問題 | No.2685 Cell Proliferation (Easy) |
ユーザー |
![]() |
提出日時 | 2024-03-20 22:08:17 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 49 ms / 2,000 ms |
コード長 | 668 bytes |
コンパイル時間 | 5,204 ms |
コンパイル使用メモリ | 311,660 KB |
実行使用メモリ | 7,552 KB |
最終ジャッジ日時 | 2024-09-30 07:59:42 |
合計ジャッジ時間 | 6,280 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 26 |
ソースコード
#include <bits/stdc++.h> #include <atcoder/all> #define rep(i, a, b) for (ll i = (ll)(a); i < (ll)(b); i++) using namespace std; using namespace atcoder; typedef long long ll; using mint = modint998244353; int main() { int p1, p2, q1, q2, t; cin >> p1 >> p2 >> q1 >> q2 >> t; mint p = p1, q = q1; p /= p2, q /= q2; vector<vector<mint> > dp(t + 1, vector<mint>(t + 1)); dp[0][0] = 1; rep(i, 0, t) { rep(j, 0, t) { dp[i + 1][0] += (mint)p * dp[i][j]; dp[i + 1][j + 1] += (mint)q.pow(j + 1) * dp[i][j]; } } mint ans = 0; rep(i, 0, t + 1) ans += dp[t][i]; cout << ans.val() << endl; }