結果

問題 No.2527 H and W
ユーザー mattu34mattu34
提出日時 2023-11-04 15:24:15
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,060 ms / 2,000 ms
コード長 869 bytes
コンパイル時間 237 ms
コンパイル使用メモリ 81,832 KB
実行使用メモリ 217,604 KB
最終ジャッジ日時 2023-11-04 15:24:45
合計ジャッジ時間 29,720 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,042 ms
215,328 KB
testcase_01 AC 1,021 ms
215,328 KB
testcase_02 AC 1,030 ms
217,404 KB
testcase_03 AC 1,041 ms
215,328 KB
testcase_04 AC 1,057 ms
217,404 KB
testcase_05 AC 1,052 ms
217,388 KB
testcase_06 AC 1,056 ms
217,604 KB
testcase_07 AC 1,039 ms
215,328 KB
testcase_08 AC 1,030 ms
217,388 KB
testcase_09 AC 1,059 ms
217,408 KB
testcase_10 AC 1,055 ms
217,388 KB
testcase_11 AC 1,055 ms
217,408 KB
testcase_12 AC 1,055 ms
217,408 KB
testcase_13 AC 1,056 ms
217,408 KB
testcase_14 AC 1,034 ms
217,408 KB
testcase_15 AC 1,057 ms
217,408 KB
testcase_16 AC 1,033 ms
217,404 KB
testcase_17 AC 1,060 ms
217,408 KB
testcase_18 AC 1,033 ms
217,408 KB
testcase_19 AC 1,056 ms
217,408 KB
testcase_20 AC 1,051 ms
217,408 KB
testcase_21 AC 1,040 ms
215,328 KB
testcase_22 AC 1,041 ms
215,328 KB
testcase_23 AC 1,026 ms
215,328 KB
testcase_24 AC 1,025 ms
217,388 KB
testcase_25 AC 1,039 ms
217,388 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

dxdy1 = ((0, 1), (0, -1), (1, 0), (-1, 0))
dxdy2 = ((0, 1), (0, -1), (1, 0), (-1, 0), (1, 1), (-1, -1), (1, -1), (-1, 1))
dxdy3 = ((0, 1), (1, 0))
dxdy4 = ((1, 1), (1, -1), (-1, 1), (-1, -1))
INF = float("inf")
MOD = 998244353
mod = 998244353
MOD2 = 10**9 + 7
mod2 = 10**9 + 7
# memo : len([a,b,...,z])==26

H, W, K = map(int, input().split())
N = 10**6
# 階乗 & 逆元計算
factorial = [1]
inverse = [1]
for i in range(1, N + 2):
    factorial.append(factorial[-1] * i % MOD)
    inverse.append(pow(factorial[-1], MOD - 2, MOD))


# 組み合わせ計算
def nCr(n, r):
    if n < r or r < 0:
        return 0
    elif r == 0:
        return 1
    return factorial[n] * inverse[r] % MOD * inverse[n - r] % MOD


ans = 0
for a in range(W):
    if K % (W - a) != 0:
        continue
    b = H - K // (W - a)

    ans += nCr(W, a) * nCr(H, b)
    ans %= MOD
print(ans)
0