結果

問題 No.314 ケンケンパ
ユーザー しらゆきしらゆき
提出日時 2015-12-27 09:04:16
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 70 ms / 1,000 ms
コード長 484 bytes
コンパイル時間 701 ms
コンパイル使用メモリ 107,656 KB
実行使用メモリ 40,064 KB
最終ジャッジ日時 2024-09-19 07:22:08
合計ジャッジ時間 2,018 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 17
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;

class Program
{
    static void Main()
    {
        int n = int.Parse(Console.ReadLine());

        var a = new long[n];
        var b = new long[n];
        var c = new long[n];
        a[0] = 1;
        int m = 1000000007;

        for (int i = 1; i < n; i++)
        {
            a[i] = c[i - 1] % m;
            b[i] = a[i - 1] % m;
            c[i] = (a[i - 1] + b[i - 1]) % m;
        }

        Console.WriteLine((a[n - 1] + b[n - 1] + c[n - 1]) % m);
    }
}
0