입력받은 n개의 약수들 중 가장 작은 수와 가장 큰 수의 곱을 출력한다.
약수의 성질이 그렇다.
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
int t, n;
cin >> t;
for (int i = 1; i <= t; i++) {
cout << "#" << i << " ";
cin >> n;
vector<int> v(n);
for (int j = 0; j < n; j++) cin >> v[j];
sort(v.begin(), v.end());
cout << v[0] * v[n - 1] << "\n";
}
return 0;
}
난이도가 왜이래