結果

問題 No.314 ケンケンパ
ユーザー zuvizudarzuvizudar
提出日時 2017-03-17 22:33:18
言語 C
(gcc 12.3.0)
結果
AC  
実行時間 10 ms / 1,000 ms
コード長 300 bytes
コンパイル時間 825 ms
コンパイル使用メモリ 28,424 KB
実行使用メモリ 25,296 KB
最終ジャッジ日時 2023-09-17 19:25:34
合計ジャッジ時間 1,870 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include<stdio.h>
#define MOD 1000000007
long long dp[1000001][3];

int main(){
		int n;
		scanf("%d",&n);
		dp[0][0]=1;
		for(int i=1;i<=n;i++){
				dp[i][0]=(dp[i-1][1]+dp[i-1][2])%MOD;
				for(int j=1;j<=2;j++)dp[i][j]=dp[i-1][j-1];
			}

			printf("%lld\n",(dp[n][0]+dp[n][1]+dp[n][2])%MOD);
		}
0