Untitled
unknown
c_cpp
a year ago
497 B
14
Indexable
#include<bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 5;
int came[maxn], sb[maxn];
void gharbal(int n){
int ind = 0;
for(int i = 2; i < n; i++){
for(int j = 1; j * i < n; j++){
sb[i] += came[j * i] ;
}
}
}
int main(){
int n, x;
cin >> n;
for(int i = 0; i < n; i++){
cin >> x;
came[x]++;
}
gharbal(maxn);
int ans = 1;
for(int i = maxn - 1; i > 0; i--){
if(sb[i] >= 2){
ans = i;
break;
}
}
cout << ans;
}Editor is loading...
Leave a Comment