題目敘述:https://zerojudge.tw/ShowProblem?problemid=a825
#include <iostream>
#include <algorithm>
using namespace std;
int main(int argc, const char * argv[]) {
int n;
while (cin >> n){
int x = 0, y = 0, a[n];
for (int i = 0; i < n; i++){
cin >> a[i];
}
sort(a, a+n);
for (int i = n-1; i >= 0; i--){
if (x <= y){
x *= 10;
x += a[i];
}else{
y *= 10;
y += a[i];
}
}
cout << x * y << endl;
}
}