結果

問題 No.2527 H and W
ユーザー 👑 KA37RIKA37RI
提出日時 2023-11-03 22:56:55
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 468 ms / 2,000 ms
コード長 475 bytes
コンパイル時間 374 ms
コンパイル使用メモリ 11,820 KB
実行使用メモリ 49,324 KB
最終ジャッジ日時 2023-11-03 22:57:06
合計ジャッジ時間 9,783 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 25 ms
10,056 KB
testcase_01 AC 26 ms
10,056 KB
testcase_02 AC 431 ms
49,324 KB
testcase_03 AC 25 ms
10,056 KB
testcase_04 AC 419 ms
49,324 KB
testcase_05 AC 416 ms
49,324 KB
testcase_06 AC 438 ms
49,316 KB
testcase_07 AC 25 ms
10,056 KB
testcase_08 AC 424 ms
49,324 KB
testcase_09 AC 281 ms
49,324 KB
testcase_10 AC 305 ms
49,320 KB
testcase_11 AC 409 ms
49,324 KB
testcase_12 AC 410 ms
49,324 KB
testcase_13 AC 468 ms
49,324 KB
testcase_14 AC 422 ms
49,324 KB
testcase_15 AC 423 ms
49,324 KB
testcase_16 AC 415 ms
49,324 KB
testcase_17 AC 397 ms
49,324 KB
testcase_18 AC 391 ms
49,324 KB
testcase_19 AC 266 ms
33,572 KB
testcase_20 AC 260 ms
37,224 KB
testcase_21 AC 293 ms
49,324 KB
testcase_22 AC 286 ms
49,324 KB
testcase_23 AC 286 ms
49,324 KB
testcase_24 AC 277 ms
35,484 KB
testcase_25 AC 271 ms
43,504 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

mod = 998244353
h, w, k = [int(x) for x in input().split()]
if h > w:
	h, w = w, h
fc = [1]
for i in range(1, w + 2):
	fc.append(fc[-1] * i % mod)
hw_rem = []
ans = 0
for i in range(1, h + 1):
	if k % i == 0:
		hw_rem.append(i)
for x in hw_rem:
	y = w - k // x
	if y < 0: continue
	a = fc[h] * pow(fc[h-x], mod - 2, mod) * pow(fc[x], mod - 2, mod) % mod
	b = fc[w] * pow(fc[w-y], mod - 2, mod) * pow(fc[y], mod - 2, mod) % mod
	ans += a * b
	ans %= mod
print(ans)
0