結果
問題 |
No.502 階乗を計算するだけ
|
ユーザー |
|
提出日時 | 2024-10-14 22:49:11 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 753 bytes |
コンパイル時間 | 1,597 ms |
コンパイル使用メモリ | 169,564 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-10-14 22:49:18 |
合計ジャッジ時間 | 6,234 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 42 WA * 10 |
ソースコード
#include <bits/stdc++.h> using namespace std; // clang-format off struct Fast {Fast() {std::cin.tie(0); ios::sync_with_stdio(false);}} fast; // clang-format on #define int long long const int MOD = 1000000007; const int MODSplit = 100000000; signed main() { int N; cin >> N; if (N >= MOD){ cout << 0 << '\n'; } else { vector<int> A_list = {1, 15000001, 960000008, 835000008, 640000008,375000008, 40000008, 635000015, 160000015, 615000022, 22}; int tmp = A_list[N / MODSplit]; if (N != 0){ int start = N - (N % MODSplit) + 1; for (int i = start; i <= N; i++) { tmp = (tmp * i) % MOD; } } cout << tmp << '\n'; } return 0; }