Search
 
SCRIPT & CODE EXAMPLE
 

CPP

Maximum Cake Tastiness codeforces solution

#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;

int main()
{

   int t;
   cin >> t;
   for (int j = 0; j < t; j++)
   {
	   int n;
	   cin >> n;
	   vector<int> v(n);
	   for (int i = 0; i < n; i++)  cin >> v[i];
	   sort(v.begin(), v.end(), greater<int>());
	   int max;
	   max = v[0] + v[1];
	   cout << max << "
";
   }

	return 0;
}
Comment

PREVIOUS NEXT
Code Example
Cpp :: my cpp 
Cpp :: run program until ctrl-d c++ 
Cpp :: can map return a value to a variable in c++ 
Cpp :: Passing a string to a function 
Cpp :: second smallest element using single loop 
Cpp :: easy way to learn file handling in c++ array 
Cpp :: swift functions from cpp 
Cpp :: how to replace a element in a vector c++ using index 
Cpp :: days in a year c++ 
Cpp :: Reading package lists... Done Building dependency tree Reading state information... Done mysql-server is already the newest version (5.7.36-0ubuntu0.18.04.1). 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 
Cpp :: copy constructor in c++ questions 
Cpp :: how to test if char in = to another in c++ 
Cpp :: multiple objects in vector C++ 
Cpp :: Studying Alphabet codechef solution in c++ 
Cpp :: convert "c++ to c" code online 
Cpp :: codeform 
Cpp :: cplusplus 
Cpp :: racing horses codechef solution c++ 
Cpp :: sin trigonometric function 
Cpp :: convert c++ code to exe 
Cpp :: how to read qlistwidget in c++ 
Cpp :: Lapindromes codechef solution in c++ 
Cpp :: inversed priority queue 
Cpp :: cuda atomic swap 
Cpp :: c++ loop vector iterator 
Cpp :: c++ split string by sstream 
Cpp :: use of strtok 
Cpp :: cpp set time 
C :: color text in C 
C :: .gitkeep file 
ADD CONTENT
Topic
Content
Source link
Name
9+5 =