fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. int main(){
  4. int t;
  5. cin>>t;
  6. while(t--){
  7. int n;
  8. cin>>n;
  9. int array[n];
  10. for (int i=0; i<n; i++)
  11. cin>>array[i];
  12. sort(array,array+n);
  13. cout<<array[n-1]*array[n-2]<<endl;
  14. }
  15. return 0;
  16. }
Success #stdin #stdout 0s 3144KB
stdin
1
5 
2 8 3 6 1
stdout
48