Solution maximale de codes de dédication de gâteaux
#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 << "\n";
}
return 0;
}
coder