Maximum product of two numbers
/*
http://ideone.com/jH9ysX
http://www.practice.geeksforgeeks.org/problem-page.php?pid=453
*/
#include <iostream>
#include <string>
#include <limits.h>
using namespace std;
int main() {
int t, n;
cin >> t;
while(t--){
cin >> n;
int a[51];
for(int i=0; i<n; i++)
cin >> a[i];
int max = INT_MIN;
int secMax = INT_MIN;
for(int i=0; i<n; i++){
if(a[i] > max){
secMax = max;
max = a[i];
}else if(a[i] > secMax && (a[i] != max)){
secMax = a[i];
}
}
cout << max * secMax << endl;
}
return 0;
}