結果

問題 No.954 Result
コンテスト
ユーザー pengin_2000
提出日時 2020-03-05 21:14:10
言語 C(gnu17)
(gcc 15.2.0)
コンパイル:
gcc-15 -O2 -std=gnu17 -Wno-error=implicit-function-declaration -Wno-error=implicit-int -Wno-error=incompatible-pointer-types -Wno-error=int-conversion -DONLINE_JUDGE -o a.out _filename_ -lm
実行:
./a.out
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 548 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 156 ms
コンパイル使用メモリ 38,592 KB
最終ジャッジ日時 2026-02-22 05:25:04
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 7
other AC * 29
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include<stdio.h>
int main()
{
	long long int i, j;
	long long int a[5];
	for (i = 0; i < 5; i++)
		scanf("%lld", &a[i]);
	long long int f[90];
	f[0] = 1;
	f[1] = 1;
	for (i = 2; i < 90; i++)
		f[i] = f[i - 1] + f[i - 2];
	int ans = 0;
	i = 0;
	while (f[i] < a[4])
		i++;
	j = 4;
	while (f[i] == a[j])
	{
		ans++;
		i++;
		j--;
		if (j < 0)
			break;
	}
	if (a[4] == 1)
	{
		int v = 0;
		i = 1;
		j = 4;
		while (f[i] == a[j])
		{
			v++;
			i++;
			j--;
			if (j < 0)
				break;
		}
		if (ans < v)
			ans = v;
	}
	printf("%d\n", ans);
	return 0;
}
0