Advertisement
Saleh127

CSES 1081 / Number Theory

Apr 11th, 2022
758
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.71 KB | None | 0 0
  1. /***
  2.  created: 2022-04-11-14.09.31
  3. ***/
  4.  
  5. #include <bits/stdc++.h>
  6. using namespace std;
  7. #define ll long long
  8. #define test int tt; cin>>tt; for(int cs=1;cs<=tt;cs++)
  9. #define get_lost_idiot return 0
  10. #define nl '\n'
  11.  
  12. ll x[1000005];
  13.  
  14. int main()
  15. {
  16.     ios_base::sync_with_stdio(0);
  17.     cin.tie(0);
  18.     cout.tie(0);
  19.  
  20.     ll n,m,i,j,k,l;
  21.  
  22.     cin>>n;
  23.  
  24.     for(i=0; i<n; i++)
  25.     {
  26.         cin>>k;
  27.         x[k]++;
  28.     }
  29.  
  30.     for(i=1000000; i>=1; i--)
  31.     {
  32.         l=0;
  33.         for(j=i; j<=1000000; j+=i)
  34.         {
  35.             if(x[j]) l+=x[j];
  36.             if(l>=2)
  37.             {
  38.                 cout<<i<<nl;
  39.                 return 0;
  40.             }
  41.         }
  42.     }
  43.     get_lost_idiot;
  44. }
  45.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement