题目链接:
https://codeforces.com/problemset/problem/1263/A
题面:
题意:
给定三种糖的数量 ,现在一天必须吃两个不一样的糖,问最多能吃多少天。
思路:
首先确定三种糖果的数量大小, 排序后,很好理解 则只能吃 天,如果 ,则有 ,答案就是 。
参考代码:
/* CF was purple years ago!
* Thanks cf-tool!
* Author: nuoyanli
* Time: 2019-12-08 12:59:09
**/
//#include <bits/stdc++.h>
#include<iostream>
#include<algorithm>
#define inf 0x3f3f3f3f
#define lson l, mid, root << 1
#define rson mid + 1, r, root << 1 | 1
#define min(a, b) a > b ? b : a
#define max(a, b) a < b ? b : a
#define ll long long
using namespace std;
const int N = 2e5 + 10;
signed main() {
ios::sync_with_stdio(false);
cin.tie(0);
int t;
cin >> t;
while (t--) {
int a[3],sum=0;
for(int i=0; i<3; i++)cin>>a[i],sum+=a[i];
sort(a,a+3);
if(a[0]+a[1]>=a[2]){
cout<<(int)sum/2<<endl;
}else{
cout<<sum-a[2]<<endl;
}
}
return 0;
}