Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- #define ll long long
- #define test int t; cin>>t; for(int cs=1;cs<=t;cs++)
- ll p[15]={2,3,5,7,11,13,17,19,23,29,31,37,41,43,47};
- ll a[100],ans=1e18;
- int main()
- {
- ios_base::sync_with_stdio(0);
- cin.tie(0);cout.tie(0);
- ll n,i,j,k,l;
- cin>>n;
- for(i=1;i<=n;i++)
- {
- cin>>a[i];
- }
- for(i=1;i<(1<<15);i++)
- {
- ll c=1;
- for(j=0;j<15;j++)
- {
- if(i&(1<<j)) c*=p[j];
- }
- ll k=0;
- for(l=1;l<=n;l++)
- {
- if(__gcd(a[l],c)==1)
- {
- k=1;
- break;
- }
- }
- if(k==0) ans=min(ans,c);
- }
- cout<<ans<<endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment