結果

問題 No.2527 H and W
ユーザー noriocnorioc
提出日時 2023-11-04 00:38:37
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 101 ms / 2,000 ms
コード長 831 bytes
コンパイル時間 501 ms
コンパイル使用メモリ 81,832 KB
実行使用メモリ 75,532 KB
最終ジャッジ日時 2023-11-04 00:38:42
合計ジャッジ時間 4,308 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 35 ms
53,504 KB
testcase_01 AC 34 ms
53,504 KB
testcase_02 AC 100 ms
75,284 KB
testcase_03 AC 35 ms
53,504 KB
testcase_04 AC 34 ms
53,504 KB
testcase_05 AC 98 ms
75,284 KB
testcase_06 AC 99 ms
75,532 KB
testcase_07 AC 34 ms
53,504 KB
testcase_08 AC 100 ms
75,284 KB
testcase_09 AC 85 ms
74,896 KB
testcase_10 AC 86 ms
74,896 KB
testcase_11 AC 99 ms
75,284 KB
testcase_12 AC 100 ms
75,412 KB
testcase_13 AC 99 ms
75,412 KB
testcase_14 AC 100 ms
75,412 KB
testcase_15 AC 99 ms
75,284 KB
testcase_16 AC 100 ms
75,412 KB
testcase_17 AC 100 ms
75,284 KB
testcase_18 AC 101 ms
75,284 KB
testcase_19 AC 77 ms
69,004 KB
testcase_20 AC 82 ms
70,460 KB
testcase_21 AC 101 ms
75,412 KB
testcase_22 AC 99 ms
75,412 KB
testcase_23 AC 100 ms
75,412 KB
testcase_24 AC 78 ms
69,772 KB
testcase_25 AC 82 ms
72,964 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

class Comb:
    def __init__(self, n, mod):
        fact = [0] * (n + 1)
        fact[0] = 1
        for i in range(1, n+1):
            fact[i] = i * fact[i-1] % mod

        ifact = [0] * (n + 1)
        ifact[n] = pow(fact[n], mod-2, mod)
        for i in range(n, 0, -1):
            ifact[i-1] = ifact[i] * i % mod
        self.fact = fact
        self.ifact = ifact
        self.mod = mod

    def __call__(self, n, k):
        if n < 0 or k > n: return 0
        return (self.fact[n] * self.ifact[k] % self.mod) * self.ifact[n-k] % self.mod


MOD = 998244353
H, W, K = map(int, input().split())

if K == H * W:
    print(1)
    exit()

comb = Comb(max(H, W), MOD)
ans = 0
for h in range(1, H+1):
    if K % h != 0: continue
    w = K // h
    if w > W: continue
    ans += comb(H, h) * comb(W, w)
    ans %= MOD

print(ans)
0