結果

問題 No.2527 H and W
ユーザー hitonanode
提出日時 2023-11-03 22:08:32
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 20 ms / 2,000 ms
コード長 542 bytes
コンパイル時間 666 ms
コンパイル使用メモリ 83,728 KB
実行使用メモリ 7,536 KB
最終ジャッジ日時 2024-09-25 20:32:43
合計ジャッジ時間 1,954 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <atcoder/modint>
#include <iostream>
using mint = atcoder::modint998244353;
using namespace std;

mint facs[1000001];

int main() {
    long long H, W, K;
    cin >> H >> W >> K;

    facs[0] = 1;
    for (int i = 1; i <= 1000000; ++i) facs[i] = facs[i - 1] * i;

    mint ret = 0;
    for (long long d = 1; d <= H; ++d) {
        if (K % d) continue;
        long long e = K / d;
        if (e > W) continue;

        ret += facs[H] / facs[d] / facs[H - d] * facs[W] / facs[e] / facs[W - e];
    }

    cout << ret.val() << '\n';
}
0