首页 > 其他 > 详细

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

时间:2019-11-30 16:21:08      阅读:91      评论:0      收藏:0      [点我收藏+]
#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;
}

 

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

原文:https://www.cnblogs.com/cminus/p/11962578.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!