結果

問題 No.2120 場合の数の下8桁
ユーザー kuronikuroni
提出日時 2022-11-08 10:54:53
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 1,012 bytes
コンパイル時間 1,861 ms
コンパイル使用メモリ 167,100 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-28 23:52:34
合計ジャッジ時間 11,032 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 TLE -
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 1 ms
4,376 KB
testcase_12 AC 1 ms
4,376 KB
testcase_13 AC 8 ms
4,376 KB
testcase_14 AC 17 ms
4,380 KB
testcase_15 AC 654 ms
4,380 KB
testcase_16 TLE -
testcase_17 AC 1,177 ms
4,380 KB
testcase_18 AC 1 ms
4,380 KB
testcase_19 AC 1,214 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/modint>
using namespace std;
using namespace atcoder;

using mint = static_modint<100000000>;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int m, n; cin >> m >> n;
    mint ans = 1;
    int p2 = 0, p5 = 0;
    if (n > m) {
        ans = 0;
    } else {
        for (int i = 1; i <= n; i++) {
            {
                int x = i;
                while (x % 2 == 0) {
                    p2--; x /= 2;
                }
                while (x % 5 == 0) {
                    p5--; x /= 5;
                }
                ans /= x;
            }
            {
                int x = m - i + 1;
                while (x % 2 == 0) {
                    p2++; x /= 2;
                }
                while (x % 5 == 0) {
                    p5++; x /= 5;
                }
                ans *= x;
            }
        }
        ans *= mint(2).pow(p2) * mint(5).pow(p5);
    }
    cout << setfill('0') << setw(8) << ans.val();
}
0