Codeforces Round #603 (Div. 2) A.Sweet Problem

#include <cstdio>
#include <algorithm>
using namespace std;
int main() {
    int t;
    scanf("%d", &t);
    while (t--) {
        int r, g, b;
        scanf("%d %d %d", &r, &g, &b);
        int sum = r + g + b;
        int maxn = max(r, g);
        maxn = max(maxn, b);
        if (sum - maxn <= maxn)
            printf("%d\n", sum - maxn);
        else
            printf("%d\n", (sum - 2 * maxn) / 2 + maxn);
    }
    return 0;
}

猜你喜欢

转载自www.cnblogs.com/cminus/p/11962578.html