The meaning of problems
https://vjudge.net/problem/CodeForces-1250L
There are three types of people, a, b, c, now put these people into three groups, a and c class can not be in the same group, the largest of the minimum number of three groups after grouping is asked how much.
Thinking
Starting from a and c, a and c are not as a group, then it is surely the a and c the number of part two more points to b, how many points do? If c is less than a Class class, then the class of the whole into a first group, the second half of the group assigned to the class c, the remaining portion into a third set of class c, b and then to the three classes of people per the number of minimal set of plug group, so we can guarantee a minimum number of the largest group.
Code
#include<bits/stdc++.h> using namespace std; #define inf 0x3f3f3f3f #define ll long long const int N=200005; const int mod=1e9+7; const double eps=1e-8; const double PI = acos(-1.0); #define lowbit(x) (x&(-x)) int main() { std::ios::sync_with_stdio(false); int t; cin>>t; while(t--) { int a,b,c; cin>>a>>b>>c; if(a>c) swap(a,c); int g[3]; g[0]=c/2,g[1]=c-c/2,g[2]=a; int ans=inf; while(b) { sort(g,g+3); g[0]++; b--; } cout<<max(g[0],max(g[1],g[2]))<<endl; } return 0; }