結果

問題 No.2527 H and W
ユーザー moon17moon17
提出日時 2023-11-03 23:05:22
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 149 ms / 2,000 ms
コード長 360 bytes
コンパイル時間 157 ms
コンパイル使用メモリ 81,880 KB
実行使用メモリ 83,488 KB
最終ジャッジ日時 2023-11-03 23:05:28
合計ジャッジ時間 4,749 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 104 ms
83,160 KB
testcase_01 AC 104 ms
83,160 KB
testcase_02 AC 120 ms
83,312 KB
testcase_03 AC 103 ms
83,160 KB
testcase_04 AC 125 ms
83,312 KB
testcase_05 AC 120 ms
83,312 KB
testcase_06 AC 149 ms
83,488 KB
testcase_07 AC 100 ms
83,160 KB
testcase_08 AC 117 ms
83,312 KB
testcase_09 AC 100 ms
83,160 KB
testcase_10 AC 102 ms
83,160 KB
testcase_11 AC 119 ms
83,312 KB
testcase_12 AC 123 ms
83,312 KB
testcase_13 AC 119 ms
83,312 KB
testcase_14 AC 121 ms
83,312 KB
testcase_15 AC 137 ms
83,312 KB
testcase_16 AC 123 ms
83,312 KB
testcase_17 AC 115 ms
83,312 KB
testcase_18 AC 127 ms
83,312 KB
testcase_19 AC 112 ms
83,312 KB
testcase_20 AC 116 ms
83,312 KB
testcase_21 AC 117 ms
83,312 KB
testcase_22 AC 118 ms
83,312 KB
testcase_23 AC 119 ms
83,312 KB
testcase_24 AC 118 ms
83,312 KB
testcase_25 AC 104 ms
83,312 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

h,w,k=map(int,input().split())
M=998244353
N=10**6+1
F=[1]*N;l,f=F[:],F[:]
for i in range(2,N):F[i]=F[i-1]*i%M;l[i]=-(M//i)*l[M%i]%M;f[i]=f[i-1]*l[i]%M
c=lambda l,k:0 if k>l else F[l]*f[k]*f[l-k]%M
s=[]
for i in range(h):
  j=h*w-i*w-k
  if j%(h-i):
    continue
  j//=h-i
  if 0<=j<w:
    s+=(i,j),
ans=0
for i,j in s:
  ans+=c(h,i)*c(w,j)
  ans%=M
print(ans)
0