結果
| 問題 |
No.502 階乗を計算するだけ
|
| ユーザー |
sugarrr
|
| 提出日時 | 2018-08-29 20:49:46 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,854 bytes |
| コンパイル時間 | 717 ms |
| コンパイル使用メモリ | 88,756 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-09-13 19:30:17 |
| 合計ジャッジ時間 | 4,400 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 32 WA * 10 RE * 10 |
ソースコード
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
#include<stack>
#include<queue>
#include<vector>
#include<algorithm>
#include<string>
#include<iostream>
#include<set>
#include<map>
#include<bitset>
using namespace std;
typedef long long ll;
#define i_7 (ll)(1E9+7)
#define i_5 (ll)(1E9+5)
ll mod(ll a){
ll c=a%i_7;
if(c>=0)return c;
else return c+i_7;
}
typedef pair<int,int> i_i;
typedef pair<ll,ll> l_l;
ll inf=(ll)1E12;/*10^12*/
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
////////////////////////////////////////
ll data[101]={1,250015370,777847830,64381203,129227219,664720426,220551652,805011386,71626953,368173468,388742192,633943807,546160751,248863345,642800490,227253170,217956259,448399780,343122361,203128902,904824556,976400196,409788350,969665321,942841378,78633765,46429647,419288563,622773713,43950471,158036420,539867530,629028067,98679775,181067811,577131628,448714637,274699378,172718980,524877565,132400827,283566441,299777072,688241748,422054382,789638131,386613162,219084929,375238282,270146387,647619052,871756271,645927523,483519685,459833872,273602905,929096963,250231633,278589981,849449796,541794170,601214344,860331963,898831734,959047580,990713044,218658983,293444525,385243308,352821537,722869575,381109223,378511108,85458370,915965688,815695490,160874373,185206871,724450461,862837188,463715736,360855087,398991956,806738292,541775025,609437737,40420676,773978131,742263715,320097016,446595916,239856470,851897254,213673769,51083743,328555850,784853394,300038049,426045335,808434455,900198419};
int main(){
ll n;cin>>n;
ll m=n/(ll)(1E7);
ll ans=data[m];
rep(i,m*(ll)(1E7)+1,n){
ans=mod(ans*i);
}
cout<<ans<<endl;
return 0;
}
sugarrr