結果

問題 No.314 ケンケンパ
ユーザー hhgfhn1hhgfhn1
提出日時 2018-10-18 13:52:33
言語 Java21
(openjdk 21)
結果
RE  
実行時間 -
コード長 369 bytes
コンパイル時間 2,275 ms
コンパイル使用メモリ 75,180 KB
実行使用メモリ 59,488 KB
最終ジャッジ日時 2024-04-23 17:22:37
合計ジャッジ時間 5,538 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 121 ms
59,488 KB
testcase_01 AC 110 ms
53,664 KB
testcase_02 AC 114 ms
54,072 KB
testcase_03 AC 100 ms
52,952 KB
testcase_04 RE -
testcase_05 RE -
testcase_06 AC 116 ms
53,896 KB
testcase_07 AC 113 ms
53,968 KB
testcase_08 AC 104 ms
52,880 KB
testcase_09 AC 102 ms
52,972 KB
testcase_10 AC 115 ms
53,980 KB
testcase_11 AC 103 ms
52,560 KB
testcase_12 AC 115 ms
54,048 KB
testcase_13 AC 119 ms
53,832 KB
testcase_14 AC 113 ms
53,996 KB
testcase_15 AC 110 ms
54,180 KB
testcase_16 AC 114 ms
54,020 KB
testcase_17 AC 118 ms
54,192 KB
testcase_18 AC 112 ms
55,776 KB
testcase_19 AC 124 ms
59,096 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {

	@SuppressWarnings("resource")
	public static void main(String args[]) {
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		int mod=1000000007;
		long dp[]=new long[n];
		dp[0]=1;
		dp[1]=2;
		dp[2]=2;
		for(int i=3;i<n;i++){
			dp[i]=(dp[i-3]+dp[i-2])%mod;
		}
		System.out.println(dp[n-1]);
	}
}
0