Codeforces Round #778 (Div. 1 + Div. 2, based on Technocup 2022 Final Round) 1654A. Maximum Cake Tastiness Solution
Problem Link : https://codeforces.com/contest/1654/problem/A
Solution in C++:
///La ilaha illellahu muhammadur rasulullah
///******Bismillahir-Rahmanir-Rahim******///
///Abul Hasnat Tonmoy
///Department of CSE,23rd batch
///Islamic University,Bangladesh
#include <iostream>
#include<algorithm>
using namespace std;
int main()
{
int num,t,i,ts;
cin>>t;
for(ts=1; ts<=t; ts++)
{
cin>>num;
int br[num+9];
for(i=0; i<num; i++)
cin>>br[i];
sort(br,br+num);
cout<<br[num-1]+br[num-2]<<endl;
}
}
No comments