Saleh127

CF 1350C

Sep 11th, 2020
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #define ll long long
  4. #define test int t; cin>>t; for(int cs=1;cs<=t;cs++)
  5. int main()
  6. {
  7. ios_base::sync_with_stdio(0);
  8. cin.tie(0);
  9. cout.tie(0);
  10. ll c,d,e,f,i,j,k,l,lm,gc=0;
  11.  
  12. cin>>c>>d;
  13. k=d;
  14. for(i=1;i<c;i++)
  15. {
  16. cin>>e;
  17. lm=(e*k)/__gcd(e,k);
  18. gc=__gcd(gc,lm);
  19. k=__gcd(e,k);
  20. }
  21. cout<<gc<<endl;
  22. return 0;
  23. }
  24.  
Advertisement
Add Comment
Please, Sign In to add comment