結果

問題 No.2527 H and W
ユーザー KoiKoi
提出日時 2023-11-03 22:01:04
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 186 ms / 2,000 ms
コード長 795 bytes
コンパイル時間 143 ms
コンパイル使用メモリ 81,836 KB
実行使用メモリ 213,596 KB
最終ジャッジ日時 2023-11-03 22:01:13
合計ジャッジ時間 5,059 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 148 ms
211,120 KB
testcase_01 AC 143 ms
211,120 KB
testcase_02 AC 142 ms
211,120 KB
testcase_03 AC 142 ms
211,120 KB
testcase_04 AC 166 ms
211,312 KB
testcase_05 AC 157 ms
211,312 KB
testcase_06 AC 186 ms
213,596 KB
testcase_07 AC 145 ms
211,120 KB
testcase_08 AC 145 ms
211,120 KB
testcase_09 AC 143 ms
211,120 KB
testcase_10 AC 143 ms
211,120 KB
testcase_11 AC 158 ms
211,312 KB
testcase_12 AC 156 ms
211,312 KB
testcase_13 AC 154 ms
211,312 KB
testcase_14 AC 144 ms
211,312 KB
testcase_15 AC 156 ms
211,312 KB
testcase_16 AC 142 ms
211,120 KB
testcase_17 AC 143 ms
211,120 KB
testcase_18 AC 146 ms
211,120 KB
testcase_19 AC 145 ms
211,120 KB
testcase_20 AC 146 ms
211,120 KB
testcase_21 AC 145 ms
211,120 KB
testcase_22 AC 144 ms
211,120 KB
testcase_23 AC 144 ms
211,120 KB
testcase_24 AC 145 ms
211,120 KB
testcase_25 AC 145 ms
211,120 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

Mod=998244353
H,W,K=map(int,input().split())
def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]

l=make_divisors(K)
# print(l)
facts=[]
inv_facts=[]
t=1
for i in range(10**6+1):
    facts.append(t)
    t=t*(i+1)%Mod
inv_facts.append(pow(facts[10**6],-1,Mod))
for i in range(10**6):
    inv_facts.append(inv_facts[-1]*(10**6-i)%Mod)
inv_facts.reverse()
ans=0
for s in l:
    a=s
    b=K//a
    if(a>H or b>W):
        continue
    else:
        ans+=(facts[H]*inv_facts[a]*inv_facts[H-a]%Mod)*(facts[W]*inv_facts[b]*inv_facts[W-b]%Mod)%Mod
print(ans%Mod)
0