結果

問題 No.314 ケンケンパ
ユーザー mikhailmikhail
提出日時 2019-12-05 10:51:17
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 426 bytes
コンパイル時間 2,538 ms
コンパイル使用メモリ 74,368 KB
実行使用メモリ 49,308 KB
最終ジャッジ日時 2024-05-09 21:06:05
合計ジャッジ時間 5,788 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 130 ms
41,644 KB
testcase_02 AC 129 ms
41,284 KB
testcase_03 AC 137 ms
41,416 KB
testcase_04 RE -
testcase_05 RE -
testcase_06 AC 132 ms
41,164 KB
testcase_07 AC 134 ms
41,408 KB
testcase_08 AC 134 ms
41,320 KB
testcase_09 AC 131 ms
41,256 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;
public class Main{
	
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		
		// input
		final int NUM = scan.nextInt();
		long[] kenpa = new long[NUM+1];
		
		// search
		kenpa[1] = 1;
		kenpa[2] = 2;
		kenpa[3] = 2;
		for(int i = 4; i <= NUM; i++){
			kenpa[i] = kenpa[i - 2] + kenpa[i - 3];
		}
		
		// answer
		System.out.println(kenpa[NUM] % 1000000007);
		
		
	}
}
0