結果
問題 | No.2932 えっえっ嘘嘘嘘待って待って待って???えマジで?ほんとに?マジでやばすぎなんだけど?えっおっほんとにこんなにDPしちゃっていいんですかい???マジでやばすぎなんだけど??? |
ユーザー |
![]() |
提出日時 | 2024-10-12 16:55:54 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 817 bytes |
コンパイル時間 | 840 ms |
コンパイル使用メモリ | 90,476 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-12 16:56:08 |
合計ジャッジ時間 | 1,510 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 12 |
ソースコード
#include <iostream> #include <string> #include <algorithm> #include <functional> #include <vector> #include <stack> #include <queue> #include <set> #include <map> #include <tuple> #include <cstdio> #include <cmath> #include <cassert> #include <atcoder/modint> #define rep(i, n) for(i = 0; i < n; i++) #define int long long using namespace std; using namespace atcoder; using mint = modint998244353; mint comb(int n, int k) { if (n < 0 || k < 0 || k > n) return 0; mint bo = 1; for (int i = n; i >= n - k + 1; i--) bo *= i; mint si = 1; for (int i = k; i >= 1; i--) si *= i; return bo / si; } signed main() { int h, w, m; cin >> h >> w >> m; mint ans = comb(h + w - 2, h - 1) * comb(m, h + w - 1) * mint(m).pow(h * w - (h + w - 1)); cout << ans.val() << endl; return 0; }