QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#680035#5465. Maximum GCDsakibmustafaWA 0ms3448kbC++14466b2024-10-26 19:36:322024-10-26 19:36:45

Judging History

你现在查看的是最新测评结果

  • [2024-10-26 19:36:45]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3448kb
  • [2024-10-26 19:36:32]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define int long long

signed main()
{
	int n;
	cin>>n;
	vector<int> a(n);

	for(int i = 0 ; i < n ; i++) 
		cin>>a[i];
	sort(a.begin(),a.end());
	int mn = a[0];

	while(mn>=1){
		int flag = 1;
	for(int i = 1; i < n ; i++)
	{
		if(mn<=a[i]/2)
			break;
		if(a[i] != mn && a[i]%mn != 0){
			flag=0;
			break;
		}
	}
	if(flag){
		cout<<mn<<endl;
	}
	mn/=2;
}
cout<<max(mn,1ll)<<endl;
	
	
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3448kb

input:

3
3 10 7

output:

3
1
1

result:

wrong answer Output contains longer sequence [length = 3], but answer contains 1 elements