結果

問題 No.44 DPなすごろく
ユーザー kuramubonnkuramubonn
提出日時 2023-02-04 15:13:35
言語 Java21
(openjdk 21)
結果
AC  
実行時間 127 ms / 5,000 ms
コード長 272 bytes
コンパイル時間 2,560 ms
コンパイル使用メモリ 71,268 KB
実行使用メモリ 56,196 KB
最終ジャッジ日時 2023-09-16 11:49:37
合計ジャッジ時間 6,329 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 120 ms
55,764 KB
testcase_01 AC 122 ms
55,736 KB
testcase_02 AC 123 ms
56,012 KB
testcase_03 AC 124 ms
56,196 KB
testcase_04 AC 121 ms
55,740 KB
testcase_05 AC 123 ms
55,472 KB
testcase_06 AC 123 ms
55,696 KB
testcase_07 AC 123 ms
56,064 KB
testcase_08 AC 123 ms
55,448 KB
testcase_09 AC 122 ms
55,708 KB
testcase_10 AC 124 ms
56,016 KB
testcase_11 AC 124 ms
55,968 KB
testcase_12 AC 124 ms
55,936 KB
testcase_13 AC 123 ms
55,876 KB
testcase_14 AC 126 ms
55,912 KB
testcase_15 AC 127 ms
55,688 KB
testcase_16 AC 124 ms
56,112 KB
testcase_17 AC 122 ms
55,848 KB
testcase_18 AC 126 ms
56,072 KB
testcase_19 AC 124 ms
55,616 KB
testcase_20 AC 122 ms
55,640 KB
testcase_21 AC 122 ms
56,080 KB
testcase_22 AC 124 ms
55,748 KB
testcase_23 AC 122 ms
56,052 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;
class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int num = sc.nextInt();
		long [] t = new long [] {2,1};
		for(int i = 3 ; i <= num ; i++) t[i%2] = t[0] + t[1];
		System.out.println(t[num % 2]);
	}
}
0