結果

問題 No.314 ケンケンパ
ユーザー 抹茶アイス抹茶アイス
提出日時 2023-07-25 17:07:36
言語 C#
(.NET 8.0.203)
結果
RE  
実行時間 -
コード長 703 bytes
コンパイル時間 10,184 ms
コンパイル使用メモリ 168,132 KB
実行使用メモリ 209,492 KB
最終ジャッジ日時 2024-04-10 09:00:11
合計ジャッジ時間 9,423 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 98 ms
53,084 KB
testcase_01 AC 49 ms
28,544 KB
testcase_02 AC 48 ms
28,416 KB
testcase_03 AC 48 ms
28,416 KB
testcase_04 RE -
testcase_05 AC 49 ms
28,672 KB
testcase_06 AC 49 ms
28,544 KB
testcase_07 AC 50 ms
28,908 KB
testcase_08 AC 50 ms
28,672 KB
testcase_09 AC 48 ms
28,928 KB
testcase_10 AC 50 ms
28,800 KB
testcase_11 AC 48 ms
28,800 KB
testcase_12 AC 48 ms
28,416 KB
testcase_13 AC 48 ms
28,544 KB
testcase_14 AC 49 ms
28,672 KB
testcase_15 AC 49 ms
28,904 KB
testcase_16 AC 62 ms
30,196 KB
testcase_17 AC 64 ms
32,256 KB
testcase_18 AC 78 ms
41,884 KB
testcase_19 AC 98 ms
209,492 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.csproj を復元しました (97 ms)。
MSBuild のバージョン 17.9.6+a4ecab324 (.NET)
  main -> /home/judge/data/code/bin/Release/net8.0/main.dll
  main -> /home/judge/data/code/bin/Release/net8.0/publish/

ソースコード

diff #

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

namespace yukicoder
{
    public class Program
    {
        public static void Main()
        {
            var n = int.Parse(Console.ReadLine());
            long q = 1000000007;
            var kk = new long[n];
            var pk = new long[n];
            var p = new long[n];
            pk[0] = 1;
            kk[1] = 1;
            p[1] = 1;
            for(var i = 2; i < n; i++)
            {
                p[i] = (pk[i - 1] + kk[i - 1]) % q;
                pk[i] = p[i - 1] % q;
                kk[i] = pk[i - 1] % q;
            }
            Console.WriteLine((kk[n - 1] + pk[n - 1] + p[n - 1]) % q);
        }
    }
}
0