結果

問題 No.2527 H and W
ユーザー eve__fuyukieve__fuyuki
提出日時 2024-04-02 00:52:27
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 26 ms / 2,000 ms
コード長 960 bytes
コンパイル時間 2,118 ms
コンパイル使用メモリ 204,252 KB
実行使用メモリ 11,712 KB
最終ジャッジ日時 2024-04-02 00:52:31
合計ジャッジ時間 3,886 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
11,712 KB
testcase_01 AC 15 ms
11,712 KB
testcase_02 AC 26 ms
11,712 KB
testcase_03 AC 15 ms
11,712 KB
testcase_04 AC 25 ms
11,712 KB
testcase_05 AC 26 ms
11,712 KB
testcase_06 AC 25 ms
11,712 KB
testcase_07 AC 14 ms
11,712 KB
testcase_08 AC 25 ms
11,712 KB
testcase_09 AC 14 ms
11,712 KB
testcase_10 AC 15 ms
11,712 KB
testcase_11 AC 25 ms
11,712 KB
testcase_12 AC 25 ms
11,712 KB
testcase_13 AC 25 ms
11,712 KB
testcase_14 AC 25 ms
11,712 KB
testcase_15 AC 25 ms
11,712 KB
testcase_16 AC 25 ms
11,712 KB
testcase_17 AC 25 ms
11,712 KB
testcase_18 AC 25 ms
11,712 KB
testcase_19 AC 21 ms
11,712 KB
testcase_20 AC 22 ms
11,712 KB
testcase_21 AC 24 ms
11,712 KB
testcase_22 AC 25 ms
11,712 KB
testcase_23 AC 25 ms
11,712 KB
testcase_24 AC 20 ms
11,712 KB
testcase_25 AC 14 ms
11,712 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

#include <atcoder/modint>
using namespace std;
using mint = atcoder::modint998244353;
void fast_io() {
    ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
}

mint fact[1 << 20], fact_inv[1 << 20];
void calc_fact() {
    fact[0] = 1;
    for (int i = 1; i < (1 << 20); i++) {
        fact[i] = fact[i - 1] * i;
    }
    fact_inv[(1 << 20) - 1] = fact[(1 << 20) - 1].inv();
    for (int i = (1 << 20) - 2; i >= 0; i--) {
        fact_inv[i] = fact_inv[i + 1] * (i + 1);
    }
}
mint binom(int n, int k) {
    if (n < k || n < 0 || k < 0) return 0;
    return fact[n] * fact_inv[k] * fact_inv[n - k];
}
int main() {
    fast_io();
    calc_fact();
    int h, w;
    long long k;
    cin >> h >> w >> k;
    mint ans = 0;
    for (int i = 0; i < h; i++) {
        if (k % (h - i)) {
            continue;
        }
        int j = w - k / (h - i);
        ans += binom(h, i) * binom(w, j);
    }
    cout << ans.val() << endl;
}
0