結果
問題 | No.2670 Sum of Products of Interval Lengths |
ユーザー |
👑 |
提出日時 | 2024-02-18 18:30:02 |
言語 | C (gcc 13.3.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 684 bytes |
コンパイル時間 | 375 ms |
コンパイル使用メモリ | 30,976 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-09-29 00:46:37 |
合計ジャッジ時間 | 1,057 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 1 RE * 16 |
ソースコード
#include <stdio.h>const int Mod = 998244353;long long solve_slow(int n, int m){int i, j, k, l;long long dp[203][203] = {};for (i = 1, dp[1][m+1] = 1; i <= n; i++) {for (j = 2; j <= m + 1; j++) {dp[i][j] %= Mod;if (dp[i][j] == 0) continue;for (k = 1; k <= m; k++) {if (k == j) continue;for (l = 1; i + l <= n + 1 && k + l - 1 <= m; l++) dp[i+l][k+l] += dp[i][j] * l % Mod;}}}long long ans = 0;for (j = 2; j <= m + 1; j++) ans += dp[n+1][j];return ans % Mod;}int main(){int n;long long m;scanf("%d %lld", &n, &m);if (n <= 200 && m <= 200) printf("%lld\n", solve_slow(n, m));else return -1;fflush(stdout);return 0;}