結果

問題 No.314 ケンケンパ
ユーザー しらゆきしらゆき
提出日時 2015-12-27 08:59:41
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 483 bytes
コンパイル時間 3,188 ms
コンパイル使用メモリ 106,788 KB
実行使用メモリ 34,540 KB
最終ジャッジ日時 2023-10-19 11:12:35
合計ジャッジ時間 2,322 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 43 ms
34,348 KB
testcase_01 AC 25 ms
23,836 KB
testcase_02 AC 24 ms
23,836 KB
testcase_03 AC 25 ms
23,836 KB
testcase_04 AC 25 ms
23,836 KB
testcase_05 AC 25 ms
23,836 KB
testcase_06 AC 24 ms
23,836 KB
testcase_07 AC 24 ms
23,836 KB
testcase_08 AC 25 ms
23,836 KB
testcase_09 AC 25 ms
23,836 KB
testcase_10 AC 24 ms
23,836 KB
testcase_11 AC 24 ms
23,836 KB
testcase_12 AC 24 ms
23,836 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 24 ms
23,836 KB
testcase_16 AC 24 ms
23,836 KB
testcase_17 AC 27 ms
24,008 KB
testcase_18 AC 35 ms
28,432 KB
testcase_19 AC 45 ms
34,540 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
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()
    {
        long n = long.Parse(Console.ReadLine());

        var a = new int[n];
        var b = new int[n];
        var c = new int[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