結果
問題 |
No.2120 場合の数の下8桁
|
ユーザー |
|
提出日時 | 2022-11-08 10:54:53 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,012 bytes |
コンパイル時間 | 1,756 ms |
コンパイル使用メモリ | 169,248 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-21 18:34:37 |
合計ジャッジ時間 | 10,802 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 18 TLE * 2 |
ソースコード
#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(); }