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;
}

 

posted @ 2019-11-30 15:16  cminus  阅读(89)  评论(0编辑  收藏  举报