QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#680041 | #5465. Maximum GCD | sakibmustafa | WA | 0ms | 3492kb | C++14 | 476b | 2024-10-26 19:37:39 | 2024-10-26 19:37:45 |
Judging History
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