QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#793163 | #5465. Maximum GCD | guodong# | WA | 0ms | 3512kb | C++14 | 591b | 2024-11-29 17:22:42 | 2024-11-29 17:22:54 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define For(i,a,b) for(int i = a; i <= b; ++i)
signed main()
{
#ifdef NICEGUODONG
freopen("data.in","r",stdin);
#endif
int n;
cin >> n;
vector<int> a(n);
For(i,1,n)
cin >> a[i - 1];
sort(a.begin(),a.end());
int flag = 0;
for(int i = 1; i < n; ++i){
if(a[i] % a[0] != 0 || a[i] >= 2 * a[0] + 1){
flag = 1;
break;
}
}
if(!flag)
cout << a[0] << '\n';
else
cout << max((a[0] - 1) / 2,1);
return 0;
}
详细
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3512kb
input:
3 3 10 7
output:
1
result:
wrong answer 1st numbers differ - expected: '3', found: '1'