結果

問題 No.314 ケンケンパ
ユーザー mbanmban
提出日時 2016-11-07 14:18:04
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 32 ms / 1,000 ms
コード長 439 bytes
コンパイル時間 724 ms
コンパイル使用メモリ 109,160 KB
実行使用メモリ 28,900 KB
最終ジャッジ日時 2024-05-03 22:39:11
合計ジャッジ時間 1,970 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
26,720 KB
testcase_01 AC 28 ms
26,876 KB
testcase_02 AC 32 ms
26,912 KB
testcase_03 AC 28 ms
28,800 KB
testcase_04 AC 27 ms
26,968 KB
testcase_05 AC 28 ms
26,812 KB
testcase_06 AC 27 ms
26,588 KB
testcase_07 AC 29 ms
28,900 KB
testcase_08 AC 28 ms
26,872 KB
testcase_09 AC 29 ms
26,840 KB
testcase_10 AC 28 ms
26,872 KB
testcase_11 AC 29 ms
26,720 KB
testcase_12 AC 29 ms
24,536 KB
testcase_13 AC 28 ms
26,680 KB
testcase_14 AC 29 ms
28,896 KB
testcase_15 AC 28 ms
26,844 KB
testcase_16 AC 28 ms
24,912 KB
testcase_17 AC 27 ms
26,824 KB
testcase_18 AC 27 ms
26,600 KB
testcase_19 AC 28 ms
26,892 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