結果

問題 No.314 ケンケンパ
ユーザー nanophoto12nanophoto12
提出日時 2015-12-08 01:21:37
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 107 ms / 1,000 ms
コード長 607 bytes
コンパイル時間 4,458 ms
コンパイル使用メモリ 103,424 KB
実行使用メモリ 43,612 KB
最終ジャッジ日時 2023-10-12 20:37:47
合計ジャッジ時間 4,608 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 104 ms
43,348 KB
testcase_01 AC 54 ms
22,744 KB
testcase_02 AC 54 ms
20,796 KB
testcase_03 AC 54 ms
18,628 KB
testcase_04 AC 54 ms
20,872 KB
testcase_05 AC 55 ms
20,844 KB
testcase_06 AC 56 ms
20,740 KB
testcase_07 AC 56 ms
22,704 KB
testcase_08 AC 56 ms
22,700 KB
testcase_09 AC 56 ms
22,792 KB
testcase_10 AC 55 ms
20,712 KB
testcase_11 AC 56 ms
22,676 KB
testcase_12 AC 55 ms
20,840 KB
testcase_13 AC 56 ms
20,720 KB
testcase_14 AC 56 ms
22,824 KB
testcase_15 AC 56 ms
20,664 KB
testcase_16 AC 57 ms
20,952 KB
testcase_17 AC 63 ms
22,800 KB
testcase_18 AC 82 ms
31,460 KB
testcase_19 AC 107 ms
43,612 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace No314
{
	class MainClass
	{
		public static void Main (string[] args)
		{
			var n = Convert.ToInt32(Console.ReadLine ());

			var k0 = new long[n + 1];
			var k1 = new long[n + 1];
			var k2 = new long[n + 1];

			k0 [0] = 1;

			long mod = 1000000007;

			for (int i = 1; i <= n; i++) {
				k0 [i] = k1 [i - 1] % mod + k2 [i - 1] % mod;
				k1 [i] = k0 [i - 1] % mod;
				k2 [i] = k1 [i - 1] % mod;
			}
			long sum = k0 [n] + k1 [n] + k2 [n];
			sum %= mod;
			Console.WriteLine (sum.ToString ());
		}
	}
}
0