結果

問題 No.523 LED
ユーザー 158b158b
提出日時 2017-06-02 23:27:19
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 24 ms / 2,000 ms
コード長 954 bytes
コンパイル時間 1,084 ms
コンパイル使用メモリ 82,712 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-22 01:42:48
合計ジャッジ時間 1,996 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 3 ms
4,348 KB
testcase_03 AC 1 ms
4,348 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 23 ms
4,348 KB
testcase_06 AC 2 ms
4,348 KB
testcase_07 AC 1 ms
4,348 KB
testcase_08 AC 2 ms
4,348 KB
testcase_09 AC 3 ms
4,348 KB
testcase_10 AC 2 ms
4,348 KB
testcase_11 AC 2 ms
4,348 KB
testcase_12 AC 2 ms
4,348 KB
testcase_13 AC 22 ms
4,348 KB
testcase_14 AC 1 ms
4,348 KB
testcase_15 AC 2 ms
4,348 KB
testcase_16 AC 2 ms
4,348 KB
testcase_17 AC 2 ms
4,348 KB
testcase_18 AC 24 ms
4,348 KB
testcase_19 AC 19 ms
4,348 KB
testcase_20 AC 14 ms
4,348 KB
testcase_21 AC 18 ms
4,348 KB
testcase_22 AC 6 ms
4,348 KB
testcase_23 AC 6 ms
4,348 KB
testcase_24 AC 4 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
}
0