結果

問題 No.314 ケンケンパ
ユーザー Ozu0205Ozu0205
提出日時 2015-12-12 17:58:19
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 451 bytes
コンパイル時間 630 ms
コンパイル使用メモリ 68,092 KB
実行使用メモリ 11,144 KB
最終ジャッジ日時 2023-10-13 11:50:48
合計ジャッジ時間 1,480 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<functional>
#include<set>
#include<string>
using namespace std;
const int surplus = 1000000007;
int n;
int dp[1000001][2];
int main(){
	cin >> n;
	dp[1][0] = 1;
	for (int i = 2; i <= n; i++){
		dp[i][0] = dp[i - 1][0] + dp[i - 1][1];
		dp[i][1] = dp[i - 1][0];
		dp[i][0] %= surplus;
		dp[i][1] %= surplus;
	}
	cout << (dp[n][0] + dp[n][1])%surplus << endl;
	return 0;
}
0