結果
問題 |
No.2944 Sigma Partition Problem
|
ユーザー |
![]() |
提出日時 | 2024-10-17 23:24:19 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 161 ms / 4,000 ms |
コード長 | 625 bytes |
コンパイル時間 | 6,540 ms |
コンパイル使用メモリ | 338,264 KB |
実行使用メモリ | 66,048 KB |
最終ジャッジ日時 | 2024-10-17 23:24:31 |
合計ジャッジ時間 | 11,937 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 24 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll=long long; #include <atcoder/all> using namespace atcoder; using mint=modint998244353; int main() { int m = 4000; vector<vector<mint>> dp(m+1, vector<mint>(m + 1, 0)); for(int i = 0; i <= m; i++) dp[0][i] = 1; for(int i = 0; i <= m; i++) for(int j = 0; j <= m; j++) { mint e = 0; if(j <= i) e += dp[i - j][j]; dp[i][j] = dp[i][j - 1] + e; } int q; cin >> q; for(int i = 0; i < q; i++) { int t, n, k; cin >> t >> n >> k; cout << dp[n][k].val() << endl; } }