You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
610 B
C++
31 lines
610 B
C++
#define _CRT_SECURE_NO_WARNINGS
|
|
#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING
|
|
|
|
#include <bits/stdc++.h>
|
|
|
|
using namespace std;
|
|
|
|
|
|
int a[129] = {0};
|
|
multiset<int> s;
|
|
|
|
int main() {
|
|
s.clear();
|
|
int n;
|
|
cin >> n;
|
|
for (int i = 1; i <= n; i++) {
|
|
cin >> a[i];
|
|
s.insert(a[i]);
|
|
}
|
|
int x = *s.rbegin();
|
|
multiset<int>::iterator ite;
|
|
for (int i = 1; i <= x; i++)
|
|
if (x % i == 0) {
|
|
ite = s.find(i);
|
|
if (ite != s.end())
|
|
s.erase(ite);
|
|
}
|
|
cout << *s.rbegin() << " " << x;
|
|
return 0;
|
|
}
|