L. Divide The Students

 http://codeforces.com/contest/1250/problem/L

#include <bits/stdc++.h>
//#include <queue>
//#include <cmath>
//#include <iostream>
//#include <unordered_map>

#define lson rt<<1
#define rson rt<<1|1
#define lowbit(x) ((x)&(-x))
#define mem(x,y) memset(x,y,sizeof(x))
#define pb push_back
#define INF 0x3f3f3f3f
#define ll long long
#define FAST_IO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;

const int mod=1e9+7;
const int N=5e5+9;

int tmp[4];
int main()
{
    FAST_IO;

    int T;
    cin>>T;
    while(T--)
    {
        int a,b,c;
        cin>>a>>b>>c;
        int ans=INF;

        if(a>c) swap(a,c);

        int d=c/2;

        int e=c-d;

        tmp[0]=a;
        tmp[1]=d;
        tmp[2]=e;
        while(b)
        {
            sort(tmp,tmp+3);
            tmp[0]++;
            b--;
        }
        cout<<max(tmp[0],max(tmp[1],tmp[2]))<<endl;

    }

    return 0;
}

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章