結果

問題 No.954 Result
ユーザー 37zigen37zigen
提出日時 2020-03-18 19:00:06
言語 Java21
(openjdk 21)
結果
AC  
実行時間 132 ms / 2,000 ms
コード長 839 bytes
コンパイル時間 2,288 ms
コンパイル使用メモリ 74,600 KB
実行使用メモリ 56,052 KB
最終ジャッジ日時 2023-09-17 18:11:45
合計ジャッジ時間 8,282 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 125 ms
55,780 KB
testcase_01 AC 124 ms
55,900 KB
testcase_02 AC 123 ms
55,972 KB
testcase_03 AC 124 ms
55,708 KB
testcase_04 AC 123 ms
55,716 KB
testcase_05 AC 125 ms
55,684 KB
testcase_06 AC 124 ms
55,788 KB
testcase_07 AC 123 ms
56,016 KB
testcase_08 AC 124 ms
55,948 KB
testcase_09 AC 124 ms
55,876 KB
testcase_10 AC 125 ms
55,852 KB
testcase_11 AC 126 ms
55,836 KB
testcase_12 AC 128 ms
53,900 KB
testcase_13 AC 125 ms
55,748 KB
testcase_14 AC 124 ms
55,884 KB
testcase_15 AC 124 ms
55,740 KB
testcase_16 AC 126 ms
55,620 KB
testcase_17 AC 126 ms
55,996 KB
testcase_18 AC 125 ms
55,372 KB
testcase_19 AC 126 ms
55,720 KB
testcase_20 AC 132 ms
55,644 KB
testcase_21 AC 126 ms
55,508 KB
testcase_22 AC 129 ms
55,672 KB
testcase_23 AC 126 ms
55,980 KB
testcase_24 AC 127 ms
55,396 KB
testcase_25 AC 127 ms
55,980 KB
testcase_26 AC 126 ms
55,772 KB
testcase_27 AC 126 ms
55,436 KB
testcase_28 AC 128 ms
55,704 KB
testcase_29 AC 128 ms
56,052 KB
testcase_30 AC 126 ms
55,576 KB
testcase_31 AC 127 ms
56,028 KB
testcase_32 AC 125 ms
55,872 KB
testcase_33 AC 124 ms
55,372 KB
testcase_34 AC 124 ms
55,372 KB
testcase_35 AC 125 ms
55,528 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;
		int pos = Arrays.binarySearch(Fib, a[n-1]);
		if(a[n-1]==1&&a[n-2]==1) {
			pos=0;
		}else if(a[n-1]==1) {
			pos=1;
		}
		int p=n-1;
		while (p>=0 && pos >= 0 && Fib[pos] == a[p] && p < a.length) {
			++ans;
			++pos;
			--p;
		}
		System.out.println(ans);
	}

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