結果

問題 No.44 DPなすごろく
ユーザー masayan_kazu
提出日時 2014-10-19 14:42:00
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 27 ms / 5,000 ms
コード長 570 bytes
コンパイル時間 989 ms
コンパイル使用メモリ 103,424 KB
実行使用メモリ 17,664 KB
最終ジャッジ日時 2024-12-30 09:43:11
合計ジャッジ時間 2,658 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
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