結果
問題 | No.1836 Max Matrix |
ユーザー | 👑 kakel-san |
提出日時 | 2022-02-12 00:09:13 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 815 ms / 2,000 ms |
コード長 | 1,002 bytes |
コンパイル時間 | 2,443 ms |
コンパイル使用メモリ | 69,932 KB |
実行使用メモリ | 24,036 KB |
最終ジャッジ日時 | 2023-09-10 07:23:56 |
合計ジャッジ時間 | 9,768 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 60 ms
23,860 KB |
testcase_01 | AC | 59 ms
21,792 KB |
testcase_02 | AC | 676 ms
21,956 KB |
testcase_03 | AC | 663 ms
21,868 KB |
testcase_04 | AC | 395 ms
21,804 KB |
testcase_05 | AC | 556 ms
23,880 KB |
testcase_06 | AC | 434 ms
21,872 KB |
testcase_07 | AC | 648 ms
21,800 KB |
testcase_08 | AC | 232 ms
19,816 KB |
testcase_09 | AC | 662 ms
21,736 KB |
testcase_10 | AC | 448 ms
23,788 KB |
testcase_11 | AC | 60 ms
24,036 KB |
testcase_12 | AC | 815 ms
23,924 KB |
testcase_13 | AC | 306 ms
19,796 KB |
testcase_14 | AC | 344 ms
19,764 KB |
testcase_15 | AC | 61 ms
23,856 KB |
ソースコード
using System; using static System.Console; using System.Linq; using System.Collections.Generic; class Program { static int NN => int.Parse(ReadLine()); static int[] NList => ReadLine().Split().Select(int.Parse).ToArray(); static void Main() { var c = NList; var (h, w, m) = (c[0], c[1], c[2]); var res = 0L; for (var i = 1; i <= m; ++i) { res = (res + Calc(m, i, h) * Calc(m, i, w) % mod) % mod; } WriteLine(res); } static int mod = 998_244_353; static long Calc(int max, int min, int n) { if (n == 1) return 1; if (max == min) return 1; return (Exp(max - min + 1, n) - Exp(max - min, n) + mod) % mod; } static long Exp(long n, long k) { n = n % mod; if (k == 0) return 1; if (k == 1) return n; var half = Exp(n, k / 2); var result = (half * half) % mod; return ((k % 2) == 0) ? result : ((result * n) % mod); } }