結果
問題 | No.523 LED |
ユーザー | 158b |
提出日時 | 2017-06-02 23:27:19 |
言語 | C++11 (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 24 ms / 2,000 ms |
コード長 | 954 bytes |
コンパイル時間 | 648 ms |
コンパイル使用メモリ | 83,280 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-09-22 03:25:04 |
合計ジャッジ時間 | 1,724 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 25 |
ソースコード
#include <iostream> #include <algorithm> #include <functional> #include <string> #include <climits> #include <vector> #include <numeric> #include <complex> #include <map> #include <bitset> #include <stack> #include <queue> #include <set> using namespace std; //#define __int64 long long #define REP(i,a,b) for(int i=a;i<b;i++) #define rep(i,n) REP(i,0,n) const int Vec = 4; const int Vecy[Vec] = {0,-1,0,1}; const int Vecx[Vec] = {1,0,-1,0}; const int Modd = 1000000007; const int BaseCnt = 5; const long long Base1[BaseCnt+1] = {1,2000000,4000000,6000000,8000000,10000000}; const long long Base2[BaseCnt] = {1,694465021,390946736,778494515,665093464}; //埋め込み法 int main(){ int n; long long ans = 1; cin >> n; int loc = 0; while(n > Base1[loc+1]){ loc ++; } ans = Base2[loc]; for(long long i=Base1[loc]+1; i<=n; i++){ ans *= i; ans %= Modd; ans *= (2 * i - 1); ans %= Modd; } cout << ans << endl; return 0; }