結果

問題 No.314 ケンケンパ
ユーザー mbanmban
提出日時 2016-11-07 14:18:04
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 63 ms / 1,000 ms
コード長 439 bytes
コンパイル時間 1,881 ms
コンパイル使用メモリ 101,232 KB
実行使用メモリ 26,068 KB
最終ジャッジ日時 2023-08-16 14:20:10
合計ジャッジ時間 4,173 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 61 ms
22,116 KB
testcase_01 AC 60 ms
23,832 KB
testcase_02 AC 60 ms
23,904 KB
testcase_03 AC 61 ms
25,984 KB
testcase_04 AC 58 ms
23,868 KB
testcase_05 AC 58 ms
23,868 KB
testcase_06 AC 60 ms
23,872 KB
testcase_07 AC 62 ms
25,872 KB
testcase_08 AC 63 ms
26,068 KB
testcase_09 AC 63 ms
26,024 KB
testcase_10 AC 61 ms
24,092 KB
testcase_11 AC 61 ms
23,908 KB
testcase_12 AC 61 ms
26,040 KB
testcase_13 AC 62 ms
25,916 KB
testcase_14 AC 61 ms
23,928 KB
testcase_15 AC 60 ms
23,904 KB
testcase_16 AC 60 ms
23,892 KB
testcase_17 AC 62 ms
25,960 KB
testcase_18 AC 61 ms
23,872 KB
testcase_19 AC 59 ms
24,024 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;

class Magatro
{
    static void Main()
    {
        int mod = 1000000007;
        int N = int.Parse(Console.ReadLine());
        int[] dp = new int[1000001];
        dp[1] = 1;
        dp[2] = 2;
        dp[3] = 2;
        for(int i = 4; i <= 1000000; i++)
        {
            dp[i] = (dp[i - 2] + dp[i - 3]) % mod;

        }
        Console.WriteLine(dp[N]);
    }
}
0