Saleh127

codeforces 1108B.cpp

Jun 10th, 2020
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #define test int t; cin>>t; while (t--)
  4. #define ll long long int
  5. #define Faster ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
  6. #define pi acos(-1)
  7. #define yes printf("YES\n");
  8. #define no printf("NO\n");
  9. int main()
  10. {
  11. Faster
  12. ll a[100000],c,d=-100,e[1000],f,i,j=0,k,l=1;
  13. cin>>c;
  14. for(i=0;i<c;i++)
  15. {
  16. cin>>a[i];
  17. if(a[i]>d) d=a[i];
  18. }
  19. cout<<d<<" ";
  20. sort(a,a+c);
  21. for(i=c-2;i>=0;i--)
  22. {
  23. if(a[c-1]%a[i]!=0 || a[i+1]==a[i])
  24. {
  25. cout<<a[i];
  26. return 0;
  27. }
  28. }
  29. return 0;
  30. }
Advertisement
Add Comment
Please, Sign In to add comment