結果

問題 No.44 DPなすごろく
ユーザー 101000010101000010
提出日時 2017-05-18 01:25:27
言語 Java21
(openjdk 21)
結果
AC  
実行時間 135 ms / 5,000 ms
コード長 447 bytes
コンパイル時間 4,723 ms
コンパイル使用メモリ 74,308 KB
実行使用メモリ 57,684 KB
最終ジャッジ日時 2023-10-18 00:02:19
合計ジャッジ時間 7,611 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 131 ms
57,472 KB
testcase_01 AC 135 ms
57,488 KB
testcase_02 AC 131 ms
57,236 KB
testcase_03 AC 133 ms
57,684 KB
testcase_04 AC 131 ms
57,564 KB
testcase_05 AC 130 ms
57,416 KB
testcase_06 AC 129 ms
57,396 KB
testcase_07 AC 131 ms
57,436 KB
testcase_08 AC 132 ms
57,164 KB
testcase_09 AC 131 ms
57,428 KB
testcase_10 AC 131 ms
57,600 KB
testcase_11 AC 133 ms
57,464 KB
testcase_12 AC 131 ms
57,488 KB
testcase_13 AC 133 ms
57,472 KB
testcase_14 AC 135 ms
57,448 KB
testcase_15 AC 127 ms
57,412 KB
testcase_16 AC 130 ms
57,440 KB
testcase_17 AC 129 ms
57,500 KB
testcase_18 AC 129 ms
57,440 KB
testcase_19 AC 129 ms
57,420 KB
testcase_20 AC 131 ms
57,316 KB
testcase_21 AC 133 ms
57,448 KB
testcase_22 AC 130 ms
57,428 KB
testcase_23 AC 130 ms
57,384 KB
権限があれば一括ダウンロードができます

ソースコード

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