結果

問題 No.954 Result
ユーザー ks2mks2m
提出日時 2019-12-17 00:10:49
言語 Java21
(openjdk 21)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 629 bytes
コンパイル時間 2,663 ms
コンパイル使用メモリ 71,348 KB
実行使用メモリ 49,768 KB
最終ジャッジ日時 2023-09-21 12:56:02
合計ジャッジ時間 5,264 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
49,268 KB
testcase_01 AC 39 ms
49,768 KB
testcase_02 AC 38 ms
49,064 KB
testcase_03 AC 39 ms
49,284 KB
testcase_04 WA -
testcase_05 AC 40 ms
49,352 KB
testcase_06 WA -
testcase_07 AC 39 ms
49,220 KB
testcase_08 AC 39 ms
49,132 KB
testcase_09 AC 39 ms
49,176 KB
testcase_10 AC 39 ms
49,340 KB
testcase_11 AC 38 ms
49,448 KB
testcase_12 AC 39 ms
49,348 KB
testcase_13 AC 39 ms
49,160 KB
testcase_14 AC 39 ms
49,068 KB
testcase_15 AC 38 ms
49,248 KB
testcase_16 AC 38 ms
49,248 KB
testcase_17 AC 38 ms
49,372 KB
testcase_18 AC 39 ms
49,648 KB
testcase_19 AC 38 ms
49,148 KB
testcase_20 AC 38 ms
49,248 KB
testcase_21 AC 39 ms
49,228 KB
testcase_22 AC 39 ms
49,140 KB
testcase_23 AC 38 ms
49,216 KB
testcase_24 AC 39 ms
49,128 KB
testcase_25 AC 39 ms
49,328 KB
testcase_26 AC 38 ms
47,380 KB
testcase_27 AC 38 ms
49,216 KB
testcase_28 AC 38 ms
49,256 KB
testcase_29 AC 38 ms
49,228 KB
testcase_30 AC 38 ms
49,344 KB
testcase_31 AC 39 ms
49,272 KB
testcase_32 AC 39 ms
49,404 KB
testcase_33 AC 38 ms
49,228 KB
testcase_34 AC 38 ms
49,312 KB
testcase_35 AC 38 ms
49,332 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 (n > a[i]) {
				break;
			}
			f1 = f2;
			f2 = n;
		}
		System.out.println(ans);
	}
}
0