結果

問題 No.314 ケンケンパ
ユーザー suppy193suppy193
提出日時 2016-11-10 16:28:21
言語 C90
(gcc 11.4.0)
結果
AC  
実行時間 23 ms / 1,000 ms
コード長 468 bytes
コンパイル時間 144 ms
コンパイル使用メモリ 21,376 KB
実行使用メモリ 24,960 KB
最終ジャッジ日時 2024-05-04 01:24:38
合計ジャッジ時間 1,159 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 23 ms
24,960 KB
testcase_01 AC 18 ms
24,832 KB
testcase_02 AC 18 ms
24,832 KB
testcase_03 AC 19 ms
24,832 KB
testcase_04 AC 16 ms
24,832 KB
testcase_05 AC 16 ms
24,832 KB
testcase_06 AC 15 ms
24,960 KB
testcase_07 AC 18 ms
24,832 KB
testcase_08 AC 17 ms
24,832 KB
testcase_09 AC 15 ms
24,960 KB
testcase_10 AC 18 ms
24,960 KB
testcase_11 AC 16 ms
24,960 KB
testcase_12 AC 16 ms
24,832 KB
testcase_13 AC 16 ms
24,832 KB
testcase_14 AC 17 ms
24,832 KB
testcase_15 AC 19 ms
24,960 KB
testcase_16 AC 18 ms
24,960 KB
testcase_17 AC 16 ms
24,832 KB
testcase_18 AC 18 ms
24,960 KB
testcase_19 AC 22 ms
24,832 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:6:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    6 |         scanf("%lld", &n);
      |         ^~~~~~~~~~~~~~~~~

ソースコード

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