結果

問題 No.314 ケンケンパ
ユーザー No
提出日時 2018-02-02 00:33:12
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 1,882 bytes
コンパイル時間 2,668 ms
コンパイル使用メモリ 102,784 KB
実行使用メモリ 17,792 KB
最終ジャッジ日時 2024-12-30 02:07:21
合計ジャッジ時間 4,086 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 16 WA * 1
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;

namespace y
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            long k = 1;
            long kk = 0;
            long p = 0;
            long ans = 0;

            for (int i = 2; i <= n; i++)
            {
                var k2 = p % 1000000007;                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               
                var kk2 = k % 1000000007;
                var p2 = (k + kk) % 1000000007;

                ans = (k2 + kk2 + p2) % 1000000007;

                k = k2;
                kk = kk2;
                p = p2;
            }
            Console.WriteLine(ans);
        }
    }
}
0