結果

問題 No.1836 Max Matrix
ユーザー SSRSSSRS
提出日時 2022-02-11 22:48:44
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 65 ms / 2,000 ms
コード長 534 bytes
コンパイル時間 2,940 ms
コンパイル使用メモリ 199,540 KB
実行使用メモリ 4,388 KB
最終ジャッジ日時 2023-09-10 05:04:18
合計ジャッジ時間 3,531 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 2 ms
4,384 KB
testcase_02 AC 55 ms
4,376 KB
testcase_03 AC 56 ms
4,376 KB
testcase_04 AC 31 ms
4,376 KB
testcase_05 AC 47 ms
4,380 KB
testcase_06 AC 34 ms
4,380 KB
testcase_07 AC 54 ms
4,380 KB
testcase_08 AC 16 ms
4,376 KB
testcase_09 AC 54 ms
4,376 KB
testcase_10 AC 35 ms
4,384 KB
testcase_11 AC 1 ms
4,380 KB
testcase_12 AC 65 ms
4,376 KB
testcase_13 AC 25 ms
4,388 KB
testcase_14 AC 28 ms
4,380 KB
testcase_15 AC 3 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
const long long MOD = 998244353;
long long modpow(long long a, long long b){
	long long ans = 1;
	while (b > 0){
		if (b % 2 == 1){
			ans *= a;
			ans %= MOD;
		}
		a *= a;
		a %= MOD;
		b /= 2;
	}
	return ans;
}
int main(){
  int H, W, M;
  cin >> H >> W >> M;
  long long ans = 0;
  for (int i = 1; i <= M; i++){
    long long X = modpow(i, H) - modpow(i - 1, H) + MOD;
    long long Y = modpow(i, W) - modpow(i - 1, W) + MOD;
    ans += X * Y % MOD;
  }
  cout << ans % MOD << endl;
}
0