結果

問題 No.44 DPなすごろく
ユーザー wild
提出日時 2017-05-04 22:32:52
言語 Java
(openjdk 23)
結果
AC  
実行時間 136 ms / 5,000 ms
コード長 394 bytes
コンパイル時間 2,104 ms
コンパイル使用メモリ 74,648 KB
実行使用メモリ 41,388 KB
最終ジャッジ日時 2024-09-14 07:17:25
合計ジャッジ時間 6,224 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

/**
 * Created by whiled on 17/05/04.
 */
public class Main {
    public static void main(String[] args) {
        int N = (new Scanner(System.in)).nextInt();

        long[] res = new long[N+1];
        res[0] = 1;
        res[1] = 1;

        for (int i=2; i<=N; i++){
            res[i] = res[i-2] + res[i-1];
        }

        System.out.println(res[N]);
    }
}
0