QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#680035 | #5465. Maximum GCD | sakibmustafa | WA | 0ms | 3448kb | C++14 | 466b | 2024-10-26 19:36:32 | 2024-10-26 19:36: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;
}
mn/=2;
}
cout<<max(mn,1ll)<<endl;
}
詳細信息
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