結果

問題 No.44 DPなすごろく
ユーザー tsunabittsunabit
提出日時 2019-09-09 16:57:44
言語 Java21
(openjdk 21)
結果
AC  
実行時間 125 ms / 5,000 ms
コード長 438 bytes
コンパイル時間 4,313 ms
コンパイル使用メモリ 72,392 KB
実行使用メモリ 56,292 KB
最終ジャッジ日時 2023-09-10 21:38:25
合計ジャッジ時間 8,535 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 124 ms
55,712 KB
testcase_01 AC 123 ms
55,732 KB
testcase_02 AC 124 ms
55,968 KB
testcase_03 AC 124 ms
55,524 KB
testcase_04 AC 125 ms
55,872 KB
testcase_05 AC 123 ms
56,056 KB
testcase_06 AC 125 ms
56,292 KB
testcase_07 AC 124 ms
55,908 KB
testcase_08 AC 123 ms
55,576 KB
testcase_09 AC 125 ms
56,120 KB
testcase_10 AC 125 ms
55,372 KB
testcase_11 AC 124 ms
55,948 KB
testcase_12 AC 123 ms
55,680 KB
testcase_13 AC 124 ms
55,352 KB
testcase_14 AC 125 ms
56,144 KB
testcase_15 AC 124 ms
55,980 KB
testcase_16 AC 123 ms
55,796 KB
testcase_17 AC 124 ms
56,152 KB
testcase_18 AC 123 ms
55,848 KB
testcase_19 AC 124 ms
55,800 KB
testcase_20 AC 124 ms
55,696 KB
testcase_21 AC 125 ms
55,816 KB
testcase_22 AC 123 ms
55,852 KB
testcase_23 AC 123 ms
56,208 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
import java.io.*;
import java.math.*;

public class No44 {
	public static long ans = 0;
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		long[] a = new long[n];
		// フィボナッチ的なものをボトムアップで
		for(int i = 0; i < 2; i++) a[i] = i+1;
		for(int i = 2; i < n; i++) {
			a[i] = a[i-1] + a[i-2];
		}
		System.out.println(a[n-1]);
	}
}
0