結果

問題 No.44 DPなすごろく
ユーザー 101000010
提出日時 2017-05-18 01:25:27
言語 Java
(openjdk 23)
結果
AC  
実行時間 125 ms / 5,000 ms
コード長 447 bytes
コンパイル時間 3,568 ms
コンパイル使用メモリ 74,236 KB
実行使用メモリ 41,864 KB
最終ジャッジ日時 2024-09-17 21:06:43
合計ジャッジ時間 6,211 ms
ジャッジサーバーID
(参考情報)
judge1 / judge6
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class No44 {
    public static void main(String[] args){
        int N;
        Scanner sc = new Scanner(System.in);
        N = sc.nextInt();
        
        long[] combination = new long[N+1];
        combination[0] = 1;
        combination[1] = 1;
        for(int i=2; i<N+1; i++){
            combination[i] = combination[i-1] + combination[i-2];
        }
        System.out.println(combination[N]);
    }
}
0