結果

問題 No.44 DPなすごろく
ユーザー hogeki
提出日時 2016-07-30 19:18:32
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 25 ms / 5,000 ms
コード長 428 bytes
コンパイル時間 3,887 ms
コンパイル使用メモリ 108,936 KB
実行使用メモリ 25,924 KB
最終ジャッジ日時 2024-11-06 21:21:36
合計ジャッジ時間 3,944 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 20
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;

namespace DPSugoroku
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());

            long[] dp = new long[N];
            dp[N - 1] = 1;
            dp[N - 2] = 2;
            for(int n = N-3; n >= 0; n--)
            {
                dp[n] = dp[n + 1] + dp[n + 2];
            }
            Console.WriteLine(dp[0]);
        }
    }
}
0