結果

問題 No.554 recurrence formula
ユーザー newlife171128
提出日時 2018-01-04 17:20:48
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 419 bytes
コンパイル時間 2,100 ms
コンパイル使用メモリ 74,048 KB
実行使用メモリ 10,496 KB
最終ジャッジ日時 2024-12-23 03:43:34
合計ジャッジ時間 8,011 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 10 WA * 9 TLE * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <string>
#include <sstream>
#include <cmath>
#include <stack>
#include <cctype>
using namespace std;
long a[100000];

int main() {

	int n=0;
	cin>>n;
	a[1] =1;
	a[2] =2;

	long sum =0;
	for(int i=3; i<=n;i++){
		sum=0;
		for(int j=i-1; j>=1; j -=2){
			sum += a[j]%1000000007;
		}
		a[i] =i*sum;
	}
	cout<<a[n]<<endl;

	return 0;
}
0