結果

問題 No.44 DPなすごろく
ユーザー wildwild
提出日時 2017-05-04 22:32:52
言語 Java21
(openjdk 21)
結果
AC  
実行時間 132 ms / 5,000 ms
コード長 394 bytes
コンパイル時間 2,138 ms
コンパイル使用メモリ 71,416 KB
実行使用メモリ 56,176 KB
最終ジャッジ日時 2023-10-12 08:11:01
合計ジャッジ時間 6,507 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 130 ms
55,804 KB
testcase_01 AC 131 ms
55,592 KB
testcase_02 AC 130 ms
55,872 KB
testcase_03 AC 130 ms
55,816 KB
testcase_04 AC 130 ms
55,736 KB
testcase_05 AC 130 ms
56,176 KB
testcase_06 AC 130 ms
55,988 KB
testcase_07 AC 129 ms
55,880 KB
testcase_08 AC 129 ms
55,856 KB
testcase_09 AC 132 ms
55,692 KB
testcase_10 AC 130 ms
55,748 KB
testcase_11 AC 130 ms
55,672 KB
testcase_12 AC 130 ms
55,852 KB
testcase_13 AC 129 ms
55,736 KB
testcase_14 AC 131 ms
55,440 KB
testcase_15 AC 131 ms
55,668 KB
testcase_16 AC 132 ms
55,740 KB
testcase_17 AC 131 ms
55,732 KB
testcase_18 AC 130 ms
55,836 KB
testcase_19 AC 129 ms
55,728 KB
testcase_20 AC 132 ms
55,844 KB
testcase_21 AC 129 ms
55,836 KB
testcase_22 AC 129 ms
56,108 KB
testcase_23 AC 129 ms
55,940 KB
権限があれば一括ダウンロードができます

ソースコード

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