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

Most View Post

Recent post

Codeforces Round 971 (Div. 4) 2009C. The Legend of Freya the Frog Solution

  Problem Link    https://codeforces.com/contest/2009/problem/C S olution in C++: /// Author : AH_Tonmoy #include < bits / stdc ++. h ...

Powered by Blogger.