結果

問題 No.554 recurrence formula
ユーザー ohreitetsuohreitetsu
提出日時 2017-11-13 17:38:11
言語 C++11
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 376 bytes
コンパイル時間 661 ms
コンパイル使用メモリ 51,016 KB
実行使用メモリ 7,740 KB
最終ジャッジ日時 2023-08-16 12:00:56
合計ジャッジ時間 4,464 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 TLE -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
using namespace std;
typedef unsigned long long UL;
UL MOD=1000000007;
UL f(int n){
	if (n==1){
		return 1;
	}
	int i;
	UL x=0;
	int startI;
	if (n%2==0){
		startI=1;
	}else{
		startI=2;
	}
	for (i=startI;i<=n-1;i+=2){
		x+=f(i);
	}
	x*=n;
	x%=MOD;
	return x;
}
int main(int argc, char* argv[])
{
	int n;
	cin>>n;
	UL aw=f(n);
	cout<<aw<<endl;
	return 0;
}
0