IMohammedNasr

Untitled

Feb 23rd, 2022
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #define ll long long
  4.  
  5. void Warding()
  6. {
  7. ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
  8. #ifndef ONLINE_JUDGE
  9. freopen("input.txt", "r", stdin), freopen("output.txt", "w", stdout);
  10. #endif
  11. }
  12.  
  13. void solve()
  14.  
  15. {
  16. ll n, Maxx = 0;
  17. cin >> n;
  18. vector<ll> v(n);
  19. for (auto &i : v)
  20. {
  21. cin >> i;
  22. }
  23. for (int i = 0; i < n - 1; i++)
  24. {
  25. ll x = ((v[i] * v[i + 1]) / __gcd(v[i], v[i + 1]));
  26. Maxx = max(Maxx, x);
  27. }
  28.  
  29. cout << Maxx << endl;
  30. }
  31.  
  32. int main()
  33. {
  34. Warding();
  35. int t;
  36. t = 1;
  37. // cin >> t;
  38. while (t--)
  39. {
  40. solve();
  41. }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment