結果

問題 No.314 ケンケンパ
ユーザー hogekihogeki
提出日時 2016-08-28 16:49:25
言語 C#(csc)
(csc 3.9.0)
結果
RE  
実行時間 -
コード長 483 bytes
コンパイル時間 813 ms
コンパイル使用メモリ 107,892 KB
実行使用メモリ 48,320 KB
最終ジャッジ日時 2024-11-14 06:21:46
合計ジャッジ時間 2,226 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 16 RE * 1
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;

class KenKenPa2
{
	const int M = 1000000007;
	static int N;

	static void Main(String[] args)
	{
		N = int.Parse(Console.ReadLine());
		long[,,] dp = new long[2,2,N+1];
		
		dp[0,0,N] = 1;
		dp[0,1,N] = 1;
		dp[1,0,N] = 1;
		for(int i=N-1; i>=2; i--)
		{
			dp[0,0,i] = dp[1,0,i+1];
			dp[0,1,i] = (dp[0,0,i+1] + dp[1,0,i+1]) % M;
			dp[1,0,i] = dp[0,1,i+1];
		}
		dp[0,0,1] = (dp[1,0,2] + dp[0,0,2]) % M;
		dp[0,0,0] = dp[0,0,1];
		Console.WriteLine(dp[0,0,0]);
	}
}
0