結果

問題 No.44 DPなすごろく
ユーザー yuki2006
提出日時 2014-10-30 18:52:01
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 25 ms / 5,000 ms
コード長 583 bytes
コンパイル時間 1,487 ms
コンパイル使用メモリ 102,912 KB
実行使用メモリ 17,664 KB
最終ジャッジ日時 2024-12-30 14:22:55
合計ジャッジ時間 3,114 ms
ジャッジサーバーID
(参考情報)
judge1 / 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;
using System.Collections.Generic;
using System.Text;

namespace DPなすごろく
{
    class Program
    {
        static void Main(string[] args)
        {
            var str0 = int.Parse(Console.ReadLine());
            long[] koma = new long[str0 + 1];
            // ini
            koma[1] = 1;
            koma[2] = 2;

            // dp model
            for (int i = 3; i <koma.Length ; i++)
            {
                koma[i] = koma[i - 1] + koma[i - 2];
            }

            Console.WriteLine(koma[str0]);
        }
    }
}
0