ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#205250 | #3678. 取模最优 | drdilyor | 100 | 292ms | 1988kb | C++11 | 473b | 2024-06-30 09:07:59 | 2024-06-30 12:00:57 |
answer
#include<bits/stdc++.h>
#define int long long
using namespace std;
int n;
int a[100005];
signed main(){
cin>>n;
for(int i=1;i<=n;i++)cin>>a[i];
sort(a+1,a+n+1);
bool f=1;
for(int i=1;i<=n;i++){
if(a[i]!=a[1]){
if(a[i]%a[1]==0)continue;
if(a[i]-a[1]>a[1])continue;
f=0;
}
}
if(f){cout<<a[1]<<"\n";return 0;}
a[1]/=2;
cout<<a[1]<<"\n";
//a[i]%(a[i]-x)=x.
//2*x<a[i].
//x<
//to min x.
//only need
//x%y<=x/2.
return 0;
}
详细
小提示:点击横条可展开更详细的信息
Test #1:
score: 10
Accepted
time: 0ms
memory: 1200kb
input:
5 1 3 1 5 5
output:
1
result:
ok single line: '1'
Test #2:
score: 10
Accepted
time: 0ms
memory: 1208kb
input:
5 5 2 5 4 5
output:
2
result:
ok single line: '2'
Test #3:
score: 10
Accepted
time: 0ms
memory: 1208kb
input:
5 4 1 4 4 3
output:
1
result:
ok single line: '1'
Test #4:
score: 10
Accepted
time: 0ms
memory: 1212kb
input:
100 52 2 65 100 45 75 73 78 21 5 37 40 98 5 70 39 42 20 71 25 89 51 91 28 90 80 3 42 34 99 5 56 21 9...
output:
1
result:
ok single line: '1'
Test #5:
score: 10
Accepted
time: 0ms
memory: 1196kb
input:
100 16 16 32 33 16 68 48 66 16 34 16 84 16 16 16 58 34 92 89 16 16 73 99 92 32 62 16 68 57 40 35 95 ...
output:
16
result:
ok single line: '16'
Test #6:
score: 10
Accepted
time: 0ms
memory: 1200kb
input:
100 86 87 87 95 99 43 86 43 91 43 91 92 43 91 88 43 43 97 98 43 43 88 95 89 43 100 43 92 92 43 43 94...
output:
43
result:
ok single line: '43'
Test #7:
score: 10
Accepted
time: 69ms
memory: 1984kb
input:
100000 498346656 749640486 568446246 335499460 915819529 665878500 446143296 475538018 68621545 4643...
output:
6005
result:
ok single line: '6005'
Test #8:
score: 10
Accepted
time: 73ms
memory: 1988kb
input:
100000 38881124 140244317 311439234 78337106 101342969 92247808 682323226 943858635 872928450 774070...
output:
3255
result:
ok single line: '3255'
Test #9:
score: 10
Accepted
time: 76ms
memory: 1972kb
input:
100000 836058770 839969788 381989612 381989612 381989612 381989612 763979225 381989612 791054283 882...
output:
381989612
result:
ok single line: '381989612'
Test #10:
score: 10
Accepted
time: 74ms
memory: 1976kb
input:
100000 160793759 60073036 60073036 120146075 586003053 152584228 982380997 248817656 637997968 16937...
output:
60073036
result:
ok single line: '60073036'
Extra Test:
score: 0
Extra Test Passed