結果
問題 | No.502 階乗を計算するだけ |
ユーザー |
![]() |
提出日時 | 2024-04-24 21:15:05 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 499 ms / 1,000 ms |
コード長 | 647 bytes |
コンパイル時間 | 2,082 ms |
コンパイル使用メモリ | 194,896 KB |
最終ジャッジ日時 | 2025-02-21 08:49:10 |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 52 |
ソースコード
#include <bits/stdc++.h> #include <atcoder/modint> using namespace std; using mint = atcoder::modint1000000007; void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); } mint pre[11] = {1, 927880474, 933245637, 668123525, 429277690, 733333339, 724464507, 957939114, 203191898, 586445753, 698611116}; int main() { fast_io(); long long n; cin >> n; if (n >= 1000000007) { cout << 0 << endl; return 0; } int k = 1e8; mint ans = pre[n / k]; for (int i = n / k * k + 1; i <= n; i++) { ans *= i; } cout << ans.val() << endl; }