結果
問題 | No.1836 Max Matrix |
ユーザー |
![]() |
提出日時 | 2023-05-24 01:02:50 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 72 ms / 2,000 ms |
コード長 | 864 bytes |
コンパイル時間 | 853 ms |
コンパイル使用メモリ | 102,364 KB |
最終ジャッジ日時 | 2025-02-13 04:19:07 |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 13 |
ソースコード
#include <iostream>#include <vector>#include <cmath>#include <map>#include <set>#include <iomanip>#include <queue>#include <algorithm>#include <numeric>#include <deque>using namespace std;using ll = long long;const ll modc = 998244353;long long mod_exp(long long b, long long e, long long m){if (e > 0 && b == 0) return 0;long long ans = 1;b %= m;while (e > 0){if ((e & 1LL)) ans = (ans * b) % m;e = e >> 1LL;b = (b*b) % m;}return ans;}int main(){ll H, W, M, a, b, ans=0;cin >> H >> W >> M;for (int m=1; m<=M; m++){a = (mod_exp(M-m+1, H, modc) + modc - mod_exp(M-m, H, modc)) % modc;b = (mod_exp(M-m+1, W, modc) + modc - mod_exp(M-m, W, modc)) % modc;ans += (a*b) % modc;ans %= modc;}cout << ans << endl;return 0;}