結果
問題 | No.502 階乗を計算するだけ |
ユーザー |
![]() |
提出日時 | 2020-12-24 00:55:18 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 539 ms / 1,000 ms |
コード長 | 515 bytes |
コンパイル時間 | 1,821 ms |
コンパイル使用メモリ | 191,900 KB |
最終ジャッジ日時 | 2025-01-17 06:33:17 |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 52 |
ソースコード
#include <bits/stdc++.h>using namespace std;int main() {constexpr int64_t mod = 1000000007;const int64_t fact[] = {1, 927880474, 933245637, 668123525, 429277690, 733333339, 724464507, 957939114, 203191898, 586445753, 698611116};int64_t n;cin >> n;if (n >= mod) {cout << 0 << endl;return 0;}int64_t ans = fact[n / 100000000];for (int i = n / 100000000 * 100000000 + 1; i <= n; i++) {ans *= i;ans %= mod;}cout << ans << endl;}