結果

問題 No.2527 H and W
ユーザー Carpenters-CatCarpenters-Cat
提出日時 2023-11-03 21:50:03
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,580 ms / 2,000 ms
コード長 568 bytes
コンパイル時間 818 ms
コンパイル使用メモリ 11,796 KB
実行使用メモリ 166,788 KB
最終ジャッジ日時 2023-11-03 21:50:34
合計ジャッジ時間 28,941 ms
ジャッジサーバーID
(参考情報)
judge10 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
10,204 KB
testcase_01 AC 29 ms
10,204 KB
testcase_02 AC 1,533 ms
166,788 KB
testcase_03 AC 29 ms
10,204 KB
testcase_04 AC 1,538 ms
166,788 KB
testcase_05 AC 1,550 ms
166,788 KB
testcase_06 AC 1,550 ms
166,788 KB
testcase_07 AC 29 ms
10,208 KB
testcase_08 AC 1,520 ms
166,788 KB
testcase_09 AC 710 ms
88,396 KB
testcase_10 AC 721 ms
88,396 KB
testcase_11 AC 1,547 ms
166,788 KB
testcase_12 AC 1,539 ms
166,788 KB
testcase_13 AC 1,569 ms
166,788 KB
testcase_14 AC 1,509 ms
166,788 KB
testcase_15 AC 1,555 ms
166,788 KB
testcase_16 AC 1,502 ms
166,788 KB
testcase_17 AC 1,502 ms
166,788 KB
testcase_18 AC 1,580 ms
166,788 KB
testcase_19 AC 880 ms
100,208 KB
testcase_20 AC 919 ms
101,528 KB
testcase_21 AC 828 ms
88,396 KB
testcase_22 AC 834 ms
88,396 KB
testcase_23 AC 838 ms
88,396 KB
testcase_24 AC 938 ms
106,476 KB
testcase_25 AC 643 ms
78,168 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import math
H, W, K = map(int, input().split())
kai = [1] * (H + W + 1)
fkai = [1] * (H + W + 1)
mod = 998244353
for i in range(H + W) :
    kai[i + 1] = (kai[i] * (i + 1)) % mod
fkai[H + W] = pow(kai[H + W], -1, mod)
for i in range(H + W, 0, -1) :
    fkai[i - 1] = (fkai[i] * i) % mod
def comb(n : int, r : int) -> int :
    if r < 0 or n < r :
        return 0
    ret = kai[n] * fkai[r] * fkai[n - r]
    return ret % mod
ans = 0
for h in range(1, H + 1) :
    if K % h :
        continue
    w = K // h
    ans += comb(H, h) * comb(W, w)
    ans %= mod
print(ans)
0