結果
| 問題 | No.502 階乗を計算するだけ |
| コンテスト | |
| ユーザー |
Nachia
|
| 提出日時 | 2020-12-29 17:41:59 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 139 ms / 1,000 ms |
| コード長 | 608 bytes |
| コンパイル時間 | 1,800 ms |
| コンパイル使用メモリ | 191,048 KB |
| 最終ジャッジ日時 | 2025-01-17 08:04:32 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 52 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
using LL=long long;
using ULL=unsigned long long;
#define rep(i,n) for(int i=0; i<(n); i++)
const ULL M=1000000007,D=1<<25,
T[] = {
1,361946029,117175975,532814826,
638916270,709912685,565479858,534784668,
864357307,580002085,988122582,626052914,
711403642,930569788,928062158,782871805,
373979365,75908005,861919911,973727253,
963971145,892153437,976333508,204474745,
183143523,224645330,885152995,514060757,
894672548,683957845
};
int main(){
ULL x=0; cin>>x;
x=min(x,M);
ULL ans=T[x/D];
rep(i,x%D) ans=ans*(x-i)%M;
cout<<ans<<endl;
return 0;
}
Nachia