Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR 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;
}
Source by codeforces.com #
 
PREVIOUS NEXT
Tagged: #Maximum #Cake #Tastiness #codeforces #solution
ADD COMMENT
Topic
Name
4+4 =