結果
問題 | No.502 階乗を計算するだけ |
ユーザー |
![]() |
提出日時 | 2024-04-24 21:15:05 |
言語 | C++17(gcc12) (gcc 12.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 489 ms / 1,000 ms |
コード長 | 647 bytes |
コンパイル時間 | 2,078 ms |
コンパイル使用メモリ | 201,928 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-07 06:19:26 |
合計ジャッジ時間 | 6,680 ms |
ジャッジサーバー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;}