結果

問題 No.314 ケンケンパ
ユーザー suppy193suppy193
提出日時 2016-11-10 16:27:23
言語 C90
(gcc 11.4.0)
結果
RE  
実行時間 -
コード長 466 bytes
コンパイル時間 191 ms
コンパイル使用メモリ 24,264 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-16 17:34:57
合計ジャッジ時間 2,158 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <stdio.h>

int main(void) {
	long long int n, a[100001][3] = {0};
	long long int i;
	scanf("%lld", &n);
	a[1][0] = 1;
	for(i = 2;i <= n;i++){
		a[i][0] = a[i - 1][2] % 1000000007;
		a[i][1] = a[i - 1][0] % 1000000007;
		a[i][2] = (a[i - 1][0] + a[i - 1][1]) % 1000000007;
	}
	//for(i = 1;i <= n;i++){
	//	printf("%lld:%lld\n", i, (a[i][0] + a[i][1] + a[i][2]) % 1000000007);
	//}
	printf("%lld\n", (a[n][0] + a[n][1] + a[n][2]) % 1000000007);
	
	return 0;
}
0