Skip to content

Commit 512aa87

Browse files
committed
Added 1822B - Karina and Array.cpp
1 parent 5e2f6a6 commit 512aa87

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

1822B - Karina and Array.cpp

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// ॐ नमः शिवाय
2+
#include<bits/stdc++.h>
3+
using namespace std;
4+
#define ll long long
5+
6+
// Code Written By: Vikash Patel
7+
// Codeforces Profile: https://codeforces.com/profile/vikashpatel
8+
9+
int main()
10+
{
11+
int t;
12+
cin>>t;
13+
while(t--)
14+
{
15+
ll n;
16+
cin>>n;
17+
ll a[n];
18+
for(int i=0; i<n; i++)
19+
{
20+
cin>>a[i];
21+
}
22+
sort(a,a+n, greater<int>());
23+
cout<<max(a[0]*a[1], a[n-1]*a[n-2])<<endl;
24+
}
25+
return 0;
26+
}

0 commit comments

Comments
 (0)