結果

問題 No.954 Result
ユーザー ks2mks2m
提出日時 2019-12-22 00:42:11
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 640 bytes
コンパイル時間 2,400 ms
コンパイル使用メモリ 71,580 KB
実行使用メモリ 49,920 KB
最終ジャッジ日時 2023-10-11 07:09:54
合計ジャッジ時間 6,767 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 43 ms
49,668 KB
testcase_02 WA -
testcase_03 AC 42 ms
49,392 KB
testcase_04 AC 43 ms
48,996 KB
testcase_05 AC 43 ms
49,304 KB
testcase_06 AC 43 ms
49,596 KB
testcase_07 AC 43 ms
48,940 KB
testcase_08 AC 44 ms
49,532 KB
testcase_09 AC 43 ms
49,208 KB
testcase_10 AC 44 ms
49,308 KB
testcase_11 AC 43 ms
49,196 KB
testcase_12 AC 43 ms
49,152 KB
testcase_13 AC 44 ms
49,088 KB
testcase_14 AC 43 ms
49,076 KB
testcase_15 AC 43 ms
49,192 KB
testcase_16 AC 43 ms
49,184 KB
testcase_17 AC 44 ms
49,844 KB
testcase_18 AC 43 ms
49,728 KB
testcase_19 AC 45 ms
49,596 KB
testcase_20 AC 45 ms
49,380 KB
testcase_21 AC 43 ms
49,272 KB
testcase_22 AC 43 ms
49,184 KB
testcase_23 AC 43 ms
49,164 KB
testcase_24 AC 44 ms
49,316 KB
testcase_25 AC 44 ms
49,008 KB
testcase_26 AC 44 ms
49,380 KB
testcase_27 WA -
testcase_28 WA -
testcase_29 AC 42 ms
49,000 KB
testcase_30 WA -
testcase_31 AC 42 ms
49,056 KB
testcase_32 AC 43 ms
49,068 KB
testcase_33 AC 42 ms
49,020 KB
testcase_34 AC 43 ms
49,056 KB
testcase_35 AC 42 ms
49,484 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		long[] a = new long[5];
		for (int i = 0; i < a.length; i++) {
			a[4 - i] = Long.parseLong(br.readLine());
		}
		br.close();

		long f1 = 0;
		long f2 = 1;
		int i = 0;
		int ans = 0;
		if (a[0] == 1) {
			ans++;
			i++;
		}
		while (i < 5) {
			long n = f1 + f2;
			if (n == a[i]) {
				ans++;
				i++;
			} else if (ans > 0 || n > a[i]) {
				break;
			}
			f1 = f2;
			f2 = n;
		}
		System.out.println(ans);
	}
}
0