Algorithm
Code Examples
#1 Code Example with C++ Programming
Code -
C++ Programming
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define endl '\n'
#define debug(n) cout<<(n)<<endl;
const ll INF = 2e18 + 99;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int t;
cin>>t;
ll n;
while(t--){
cin>n;
ll a, b, c, max = -1;
cin>>a;
for(ll i = 1; i < n; i++){
cin>>b;
c = a * b;
max = (c > max) ? c : max;
a = b;
}
cout<<max<<endl;
}
}
Copy The Code &
Try With Live Editor
Input
4
3
2 4 3
4
3 2 3 1
2
69 69
6
719313 273225 402638 473783 804745 323328
3
2 4 3
4
3 2 3 1
2
69 69
6
719313 273225 402638 473783 804745 323328
Output
12
6
4761
381274500335
6
4761
381274500335
Demonstration
Codeforcess Solution 1554-A A. Cherry ,C++, Java, Js and Python,1554-A,Codeforcess Solution