結果

問題 No.44 DPなすごろく
ユーザー atkrymatkrym
提出日時 2016-10-18 15:36:33
言語 Java21
(openjdk 21)
結果
AC  
実行時間 145 ms / 5,000 ms
コード長 367 bytes
コンパイル時間 2,422 ms
コンパイル使用メモリ 74,168 KB
実行使用メモリ 41,612 KB
最終ジャッジ日時 2024-05-02 02:33:59
合計ジャッジ時間 6,592 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 136 ms
41,320 KB
testcase_01 AC 135 ms
41,260 KB
testcase_02 AC 130 ms
41,248 KB
testcase_03 AC 132 ms
41,256 KB
testcase_04 AC 134 ms
41,180 KB
testcase_05 AC 139 ms
41,152 KB
testcase_06 AC 138 ms
41,408 KB
testcase_07 AC 137 ms
41,504 KB
testcase_08 AC 138 ms
41,292 KB
testcase_09 AC 135 ms
41,248 KB
testcase_10 AC 145 ms
41,412 KB
testcase_11 AC 135 ms
41,000 KB
testcase_12 AC 138 ms
41,384 KB
testcase_13 AC 141 ms
41,612 KB
testcase_14 AC 138 ms
41,180 KB
testcase_15 AC 141 ms
41,328 KB
testcase_16 AC 136 ms
41,384 KB
testcase_17 AC 133 ms
41,352 KB
testcase_18 AC 141 ms
41,316 KB
testcase_19 AC 136 ms
41,164 KB
testcase_20 AC 140 ms
41,128 KB
testcase_21 AC 134 ms
41,108 KB
testcase_22 AC 135 ms
41,148 KB
testcase_23 AC 139 ms
41,524 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    private static Scanner sc = new Scanner(System.in);
    public static void main(String[] args) throws Exception {
        long[] dp = new long[51];
        dp[0] = 1;
        dp[1] = 1;
        for (int i=2;i<51;i++) {
            dp[i] = dp[i-2] + dp[i-1];
        }
        System.out.println(dp[sc.nextInt()]);
    }
}
0