QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#680041#5465. Maximum GCDsakibmustafaWA 0ms3492kbC++14476b2024-10-26 19:37:392024-10-26 19:37:45

Judging History

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

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

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;
		break;
	}
	mn/=2;
}
cout<<max(mn,1ll)<<endl;
	
	
}

详细

Test #1:

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

input:

3
3 10 7

output:

3
3

result:

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