結果

問題 No.314 ケンケンパ
ユーザー kimagureman
提出日時 2016-03-11 09:49:10
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 307 bytes
コンパイル時間 2,043 ms
コンパイル使用メモリ 159,136 KB
実行使用メモリ 11,292 KB
最終ジャッジ日時 2024-09-25 00:13:27
合計ジャッジ時間 1,872 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 6 WA * 11
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

typedef unsigned long ulong;

ulong dp[1000001];

int main(int argc, char** argv)
{
	ulong n; cin >> n;

	dp[0] = 1;
	dp[1] = dp[2] = 2;
	for (ulong ii=3; ii<n; ++ii) {
		dp[ii] = (dp[ii-2] + dp[ii-3]);
	}
	cout << (dp[n-1]%1000000007) << endl;
	return 0;
}

0