結果
問題 |
No.502 階乗を計算するだけ
|
ユーザー |
![]() |
提出日時 | 2017-04-30 16:42:15 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 666 bytes |
コンパイル時間 | 1,667 ms |
コンパイル使用メモリ | 167,948 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-09-13 23:50:20 |
合計ジャッジ時間 | 3,472 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 42 WA * 10 |
ソースコード
#include<bits/stdc++.h> using namespace std; const int MOD = 1e9+7; int main(){ long long n,ans; vector<long long int> v = { 1,76479948,27368307,888050723,661224977,261384175,547665832, 724691727,136026497,217544623,668123525,522049725,189239124, 917084264,358655417,462639908,99199382,97830135,141827977, 811575797,724464507,456152084,769795511,825871994,852304035, 217598709,624500515,423951674,814362881,256473217,586445753, 778983779,965785236,847549272 }; cin >> n; if(MOD<=n){ cout << 0 << endl; return 0; } ans = v[n/10000000]; for(int i=n/10000000*10000000+1;i<=n;i++){ ans = (ans*i)%MOD; } cout << ans << endl; return 0; }