結果
| 問題 |
No.2120 場合の数の下8桁
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-11-17 23:23:02 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 73 ms / 2,000 ms |
| コード長 | 1,070 bytes |
| コンパイル時間 | 1,429 ms |
| コンパイル使用メモリ | 169,428 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-09-19 09:29:38 |
| 合計ジャッジ時間 | 2,471 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 20 |
ソースコード
#include <bits/stdc++.h>
#include <atcoder/modint>
using namespace std;
using namespace atcoder;
const int N = 1E7 + 5;
using mint = static_modint<100000000>;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int m, n; cin >> m >> n;
mint num = 1, den = 1;
mint ans;
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;
}
den *= x;
}
{
int x = m - i + 1;
while (x % 2 == 0) {
p2++; x /= 2;
}
while (x % 5 == 0) {
p5++; x /= 5;
}
num *= x;
}
}
ans = num / den * mint(2).pow(p2) * mint(5).pow(p5);
}
cout << setfill('0') << setw(8) << ans.val();
}