Codeforces Round #593 (Div. 2) C. Labs A. Stones

题目:https://codeforces.com/contest/1236/problem/A

思路:两种操作收益都是3 且都会消耗b

           操作2对b消耗较小 则可优先选择操作2 再进行操作1 即可得到最大值

#include<bits/stdc++.h>

using namespace std;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    //freopen("in.txt","r",stdin);
    int T;cin>>T;
    while(T--)
    {
        int a,b,c;
        cin>>a>>b>>c;
        int res=min(b,c>>1)*3;
        b-=res/3;
        res+=min(a,b>>1)*3;
        cout<<res<<endl;
    }
    return 0;
}

猜你喜欢

转载自www.cnblogs.com/c4Lnn/p/12093365.html