結果

問題 No.314 ケンケンパ
ユーザー suppy193suppy193
提出日時 2016-11-10 16:28:21
言語 C90
(gcc 11.4.0)
結果
AC  
実行時間 11 ms / 1,000 ms
コード長 468 bytes
コンパイル時間 171 ms
コンパイル使用メモリ 24,188 KB
実行使用メモリ 25,348 KB
最終ジャッジ日時 2023-08-16 17:36:33
合計ジャッジ時間 1,255 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 11 ms
25,228 KB
testcase_01 AC 6 ms
25,152 KB
testcase_02 AC 7 ms
25,228 KB
testcase_03 AC 7 ms
25,140 KB
testcase_04 AC 7 ms
25,252 KB
testcase_05 AC 6 ms
25,196 KB
testcase_06 AC 7 ms
25,192 KB
testcase_07 AC 7 ms
25,232 KB
testcase_08 AC 6 ms
25,232 KB
testcase_09 AC 6 ms
25,252 KB
testcase_10 AC 7 ms
25,204 KB
testcase_11 AC 7 ms
25,192 KB
testcase_12 AC 6 ms
25,348 KB
testcase_13 AC 6 ms
25,252 KB
testcase_14 AC 8 ms
25,252 KB
testcase_15 AC 6 ms
25,308 KB
testcase_16 AC 7 ms
25,196 KB
testcase_17 AC 6 ms
25,156 KB
testcase_18 AC 8 ms
25,252 KB
testcase_19 AC 11 ms
25,248 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>

int main(void) {
	long long int n, a[1000001][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