結果
| 問題 | No.502 階乗を計算するだけ |
| コンテスト | |
| ユーザー |
trineutron
|
| 提出日時 | 2020-12-24 00:48:12 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 438 bytes |
| 記録 | |
| コンパイル時間 | 1,779 ms |
| コンパイル使用メモリ | 192,960 KB |
| 最終ジャッジ日時 | 2025-01-17 06:32:48 |
|
ジャッジサーバーID (参考情報) |
judge4 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 48 TLE * 4 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main() {
constexpr int64_t mod = 1000000007;
const int64_t fact[] = {1, 668123525, 724464507, 586445753};
int64_t n;
cin >> n;
if (n >= mod) {
cout << 0 << endl;
return 0;
}
int64_t ans = fact[n / 300000000];
for (int i = n / 300000000 * 300000000 + 1; i <= n; i++) {
ans *= i;
ans %= mod;
}
cout << ans << endl;
}
trineutron