結果

問題 No.954 Result
ユーザー 37zigen37zigen
提出日時 2019-12-17 00:19:34
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 898 bytes
コンパイル時間 3,439 ms
コンパイル使用メモリ 74,156 KB
実行使用メモリ 56,300 KB
最終ジャッジ日時 2023-09-15 19:01:38
合計ジャッジ時間 9,426 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 121 ms
55,660 KB
testcase_01 AC 122 ms
56,072 KB
testcase_02 AC 122 ms
56,204 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 121 ms
56,028 KB
testcase_08 AC 121 ms
55,468 KB
testcase_09 AC 122 ms
55,788 KB
testcase_10 AC 120 ms
56,132 KB
testcase_11 AC 123 ms
56,064 KB
testcase_12 AC 121 ms
55,916 KB
testcase_13 AC 121 ms
55,688 KB
testcase_14 AC 121 ms
55,500 KB
testcase_15 AC 121 ms
55,960 KB
testcase_16 AC 121 ms
55,708 KB
testcase_17 AC 122 ms
56,144 KB
testcase_18 AC 120 ms
55,912 KB
testcase_19 AC 120 ms
55,660 KB
testcase_20 AC 122 ms
56,056 KB
testcase_21 AC 124 ms
56,020 KB
testcase_22 AC 121 ms
55,768 KB
testcase_23 AC 119 ms
55,852 KB
testcase_24 AC 122 ms
55,856 KB
testcase_25 AC 125 ms
56,292 KB
testcase_26 AC 125 ms
56,012 KB
testcase_27 AC 120 ms
56,300 KB
testcase_28 AC 119 ms
56,024 KB
testcase_29 WA -
testcase_30 AC 124 ms
55,800 KB
testcase_31 AC 119 ms
55,668 KB
testcase_32 AC 125 ms
55,796 KB
testcase_33 AC 120 ms
55,792 KB
testcase_34 AC 121 ms
56,272 KB
testcase_35 AC 120 ms
55,972 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Arrays;
import java.util.Comparator;
import java.util.PriorityQueue;
import java.util.Scanner;

class Main {

	public static void main(String[] args) {
		new Main().run();
	}

	void run() {
		Scanner sc = new Scanner(System.in);
		int n = 5;
		long[] a = new long[n];
		for (int i = 0; i < n; ++i)
			a[i] = sc.nextLong();
		long[] Fib = new long[74];
		Fib[0] = Fib[1] = 1;
		for (int i = 2; i < Fib.length; ++i) {
			Fib[i] = Fib[i - 1] + Fib[i - 2];
		}
		int ans = 0;
		for (int i = n - 1; i >= 0; --i) {
			int pos = Arrays.binarySearch(Fib, a[i]);
			if (pos < 0)
				continue;
			int sz = 1;
			while (i - sz >= 0 && pos + sz < Fib.length && Fib[pos + sz] == a[i - sz])
				++sz;
			if (i + 1 < n && a[i + 1] == 1)
				++sz;
			ans = Math.max(ans, sz);
		}
		System.out.println(ans);
	}

	void tr(Object... objects) {
		System.out.println(Arrays.deepToString(objects));
	}
}
0