結果

問題 No.2527 H and W
ユーザー 👑 timitimi
提出日時 2023-11-03 22:43:12
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 261 ms / 2,000 ms
コード長 634 bytes
コンパイル時間 361 ms
コンパイル使用メモリ 81,868 KB
実行使用メモリ 252,076 KB
最終ジャッジ日時 2023-11-03 22:43:21
合計ジャッジ時間 7,746 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 241 ms
252,020 KB
testcase_01 AC 236 ms
252,020 KB
testcase_02 AC 238 ms
252,016 KB
testcase_03 AC 234 ms
252,020 KB
testcase_04 AC 239 ms
252,016 KB
testcase_05 AC 231 ms
252,020 KB
testcase_06 AC 237 ms
252,016 KB
testcase_07 AC 233 ms
252,072 KB
testcase_08 AC 235 ms
252,072 KB
testcase_09 AC 237 ms
252,076 KB
testcase_10 AC 259 ms
252,072 KB
testcase_11 AC 233 ms
252,072 KB
testcase_12 AC 235 ms
252,076 KB
testcase_13 AC 238 ms
252,072 KB
testcase_14 AC 235 ms
252,072 KB
testcase_15 AC 232 ms
252,076 KB
testcase_16 AC 261 ms
252,072 KB
testcase_17 AC 238 ms
252,072 KB
testcase_18 AC 236 ms
252,076 KB
testcase_19 AC 236 ms
252,072 KB
testcase_20 AC 234 ms
252,072 KB
testcase_21 AC 239 ms
252,076 KB
testcase_22 AC 246 ms
252,072 KB
testcase_23 AC 234 ms
252,072 KB
testcase_24 AC 235 ms
252,076 KB
testcase_25 AC 240 ms
252,072 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

H,W,K=map(int, input().split())
A=[]
ans=0;D={}

mod=998244353;n=10**6+100
inv_t=[0]+[1]
for i in range(2,n):
  inv_t+=[inv_t[mod%i]*(mod-int(mod/i))%mod]

kai=[1,1]
rev_kai=[1,inv_t[1]]
for i in range(2,n):
  kai.append(kai[-1]*i%mod)
  rev_kai.append(rev_kai[-1]*inv_t[i]%mod)

def cmb(n,r):
  return kai[n]*rev_kai[r]*rev_kai[n-r]%mod

for i in range(1,10**6+1):
  if K%i==0:
    a,b=i,K//i 
    if a not in D:
      D[a]=1
      if a<=H and b<=W:
        ans+=cmb(H,H-a)*cmb(W,W-b)
        ans%=mod 
    if b not in D:
      D[b]=1
      if a<=W and b<=H:
        ans+=cmb(H,H-b)*cmb(W,W-a)
        ans%=mod
print(ans)
      
    
0