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

RESTful APIs with CRUD Operations in Laravel 12| (2025)

  RESTful APIs serve as the foundation of modern web development. They follow a set of rules called Representational State Transfer (REST) t...

Powered by Blogger.