結果
| 問題 |
No.2527 H and W
|
| コンテスト | |
| ユーザー |
ID 21712
|
| 提出日時 | 2025-04-30 14:37:50 |
| 言語 | Go (1.23.4) |
| 結果 |
AC
|
| 実行時間 | 40 ms / 2,000 ms |
| コード長 | 637 bytes |
| コンパイル時間 | 14,472 ms |
| コンパイル使用メモリ | 246,328 KB |
| 実行使用メモリ | 17,792 KB |
| 最終ジャッジ日時 | 2025-04-30 14:38:10 |
| 合計ジャッジ時間 | 16,841 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 23 |
ソースコード
package main
import . "fmt"
import . "math/big"
func main() {
const Z = 1e6
const Mod = 998244353
ns := make([]int, Z+1)
ds := make([]int, Z+1)
ns[0] = 1
for i := range ns[1:] {
ns[i+1] = ns[i]*(i+1)%Mod
}
ds[Z] = int(new(Int).ModInverse(NewInt(int64(ns[Z])), NewInt(Mod)).Int64())
for i := range ds[1:] {
j := Z - i
ds[j-1] = ds[j]*j%Mod
}
var h,w,k int
Scan(&h,&w,&k)
var ans int
for i := 1; i <= h; i++ {
if k % i != 0 {
continue
}
j := k / i
if j < 1 || w < j {
continue
}
hh := ns[h]*ds[h-i]%Mod*ds[i]%Mod
ww := ns[w]*ds[w-j]%Mod*ds[j]%Mod
ans += hh*ww%Mod
ans %= Mod
}
Println(ans)
}
ID 21712