結果

問題 No.314 ケンケンパ
ユーザー TatsuDXTatsuDX
提出日時 2016-10-16 21:41:21
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 408 bytes
コンパイル時間 3,558 ms
コンパイル使用メモリ 74,964 KB
実行使用メモリ 41,512 KB
最終ジャッジ日時 2024-05-02 02:37:11
合計ジャッジ時間 7,384 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 153 ms
41,256 KB
testcase_01 AC 137 ms
40,948 KB
testcase_02 AC 134 ms
41,512 KB
testcase_03 AC 135 ms
41,136 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 135 ms
41,100 KB
testcase_07 AC 135 ms
40,940 KB
testcase_08 AC 134 ms
41,100 KB
testcase_09 AC 135 ms
41,108 KB
testcase_10 AC 136 ms
41,156 KB
testcase_11 AC 135 ms
41,172 KB
testcase_12 AC 133 ms
41,056 KB
testcase_13 AC 133 ms
40,900 KB
testcase_14 AC 140 ms
41,160 KB
testcase_15 AC 136 ms
41,012 KB
testcase_16 AC 137 ms
40,968 KB
testcase_17 AC 140 ms
41,128 KB
testcase_18 AC 147 ms
41,256 KB
testcase_19 AC 151 ms
41,072 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Test {
	public static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {
		int n = sc.nextInt();
		if(n < 3){
			System.out.println(n);
		}
		long t00 = 1, t01 = 1, t10 = 0, tmp, e = 1000000007;
		for(int i = 3; i <= n; i++){
			tmp = t00 + t10;
			t00 = t10;
			t10 = t01;
			t01 = tmp % e;
		}
		System.out.println((t00+t01+t10)%e);
	}
}
0