結果

問題 No.2527 H and W
ユーザー titiatitia
提出日時 2023-11-03 22:04:38
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 244 ms / 2,000 ms
コード長 584 bytes
コンパイル時間 200 ms
コンパイル使用メモリ 81,796 KB
実行使用メモリ 244,312 KB
最終ジャッジ日時 2023-11-03 22:04:55
合計ジャッジ時間 7,298 ms
ジャッジサーバーID
(参考情報)
judge10 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 221 ms
244,088 KB
testcase_01 AC 219 ms
244,048 KB
testcase_02 AC 237 ms
244,088 KB
testcase_03 AC 217 ms
244,048 KB
testcase_04 AC 220 ms
244,088 KB
testcase_05 AC 221 ms
244,048 KB
testcase_06 AC 225 ms
244,048 KB
testcase_07 AC 214 ms
244,048 KB
testcase_08 AC 234 ms
244,048 KB
testcase_09 AC 216 ms
244,088 KB
testcase_10 AC 218 ms
244,088 KB
testcase_11 AC 223 ms
244,048 KB
testcase_12 AC 236 ms
244,048 KB
testcase_13 AC 232 ms
244,088 KB
testcase_14 AC 237 ms
244,048 KB
testcase_15 AC 229 ms
244,048 KB
testcase_16 AC 235 ms
244,088 KB
testcase_17 AC 239 ms
244,088 KB
testcase_18 AC 244 ms
244,048 KB
testcase_19 AC 231 ms
244,048 KB
testcase_20 AC 234 ms
244,048 KB
testcase_21 AC 236 ms
244,088 KB
testcase_22 AC 237 ms
244,048 KB
testcase_23 AC 236 ms
244,048 KB
testcase_24 AC 227 ms
244,312 KB
testcase_25 AC 220 ms
244,048 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

H,W,K=map(int,input().split())

mod=998244353

FACT=[1]
for i in range(1,2*10**6+1):
    FACT.append(FACT[-1]*i%mod)

FACT_INV=[pow(FACT[-1],mod-2,mod)]
for i in range(2*10**6,0,-1):
    FACT_INV.append(FACT_INV[-1]*i%mod)

FACT_INV.reverse()

def Combi(a,b):
    if 0<=b<=a:
        return FACT[a]*FACT_INV[b]%mod*FACT_INV[a-b]%mod
    else:
        return 0

ANS=0

sc=H*W-K
for i in range(H+1):
    score=W*i

    rest=sc-score

    if rest>=0 and rest%(H-i)==0:
        k=rest//(H-i)

        ANS+=Combi(H,i)*Combi(W,k)

print(ANS%mod)
    
0