To make competitive programmers of BUBT, authority decide to take regular programming contest. To make this contest more competitive and fruitful there are some rules given to balance a team:
1. Only 1st , 2nd and 3rd year student can participate. 
2. A team must have three members. 
3. All the member cannot be from same year. 
You need to find out the maximum number of teams can build up according to given rules.

Input

The first line of input contain an integer T (1<=T<=10000) test case. Next T line contains three positive integer X, Y and Z (1<=X, Y, Z<=2*10^9) separated by a space which denotes the number of participants from 1st, 2nd, and 3rd year student.

Output

You need to find out the maximum number of teams can build up according to given rules.

Example

Input
2
1 2 3
1 12 3
Output
2
4

不能取三个同年级的,就跟这题一模一样 cf478C

如果最大的人数比另外两种的人数之和小,就可以直接组成sum/3个

否则全部都是2:1的方案

 #include<cstdio>
#include<iostream>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<cmath>
#include<queue>
#include<deque>
#include<set>
#include<map>
#include<ctime>
#define LL long long
#define inf 0x7ffffff
#define pa pair<int,int>
#define mkp(a,b) make_pair(a,b)
#define pi 3.1415926535897932384626433832795028841971
#define mod 1000000007
using namespace std;
inline LL read()
{
LL x=,f=;char ch=getchar();
while(ch<''||ch>''){if(ch=='-')f=-;ch=getchar();}
while(ch>=''&&ch<=''){x=x*+ch-'';ch=getchar();}
return x*f;
}
int main()
{
int T=read();
while (T--)
{
LL a=read(),b=read(),c=read();
printf("%lld\n",min((a+b+c)/,min(a+b,min(b+c,c+a))));
}
}

Spoj BIPCSMR16

Spoj-BIPCSMR16 Team Building的更多相关文章

  1. BZOJ 4742: [Usaco2016 Dec]Team Building

    4742: [Usaco2016 Dec]Team Building Time Limit: 10 Sec  Memory Limit: 128 MBSubmit: 21  Solved: 16[Su ...

  2. CF1316E Team Building

    CF1316E [Team Building] 状压dp,感觉比D简单 \(f[i][s]\),表示考虑前\(i\)个人,状态为\(s\)(\(s\)的第\(j-1\)个二进制位表示队员的第\(j\) ...

  3. BZOJ4742 : [Usaco2016 Dec]Team Building

    如果我们将两个人拥有的牛混在一起,并按照战斗力从小到大排序,同时把第一个人选的牛看成$)$,第二个人选的牛看成$($的话,那么我们会发现一个合法的方案对应了一个长度为$2k$的括号序列. 于是DP即可 ...

  4. 1742. Team building(dfs)

    1742 最小的是找联通块数 最大的找环 一个环算一个 其它的数各算一个 #include <iostream> #include<cstdio> #include<cs ...

  5. [USACO 2016Dec] Team Building

    [题目链接] https://www.lydsy.com/JudgeOnline/problem.php?id=4742 [算法] 动态规划 用Fi,j,k表示约翰的前i头牛和保罗的前j头牛匹配 , ...

  6. [Exchange 2013]创建约会和会议

    简介 会议和约会之间的重要区别是,会议有与会者,并且没有约会.约会和会议可以是单实例或属于重复序列,但与会者. 房间或资源中不包括约会,因为它们不需要发送一条消息.在内部,Exchange 使用相同的 ...

  7. USER STORIES AND USE CASES - DON’T USE BOTH

    We’re in Orlando for a working session as part of the Core Team building BABOK V3 and over dinner th ...

  8. 基于AWS的云服务架构最佳实践

    ZZ from: http://blog.csdn.net/wireless_com/article/details/43305701 近年来,对于打造高度可扩展的应用程序,软件架构师们挖掘了若干相关 ...

  9. SCRUM站立会议

    SCRUM站立会议是让团队成员每日面对面站立互相交流他们所承担任务的进度.它的一个附带好处是让领导或经理能了解 到工作情况.本质上是为了团队交流,不是报告会议! 功能: 1)创造团队成员相互沟通的条件 ...

随机推荐

  1. ActiveAndroid问题no such table解决总结

     android.database.sqlite.SQLiteException: no such table  at android.database.sqlite.SQLiteConnection ...

  2. 树形dp——Tree2cycle

    一.问题描述(题目链接) 给你一棵树,删除或添加一条边的费用都是1,问使它变成一个环的最小费用. 二.解题思路 回溯法,然后回溯的时候的当前节点度数>2(如果是成环的话肯定就是2或者小于2)就把 ...

  3. winhex与磁盘格式与 数据恢复

    第一阶段: 熟悉WinHex的使用. n 熟悉磁盘工具的使用. n 利用WinHex查看物理磁盘和逻辑磁盘. n 了解WinHex中相关工具的用法. 以管理员身份运行winhex(以便之后修改) 上方 ...

  4. 浏览器输入一个url到整个页面显示出来经历了哪些过程?

    https://cloud.tencent.com/developer/article/1396399 https://www.cnblogs.com/haonanZhang/p/6362233.ht ...

  5. Hermite 矩阵及其特征刻画

    将学习到什么 矩阵 \(A\) 与 \(\dfrac{1}{2}(A+A^T)\) 两者生成相同的二次型,而后面那个矩阵是对称的,这样以来,为了研究实的或者复的二次型,就只需要研究由对称矩阵生成的二次 ...

  6. c++ 输入10个数,显示它的平均分

    #include <iostream> using namespace std; void inputScores(double golfScores[], int size); void ...

  7. Bzoj 1083: [SCOI2005]繁忙的都市 (最小生成树)

    Bzoj 1083: [SCOI2005]繁忙的都市 题目链接:https://www.lydsy.com/JudgeOnline/problem.php?id=1083 此题是最小瓶颈生成树的裸题. ...

  8. [HIHO] 1050 树中的最长路

    #1050 : 树中的最长路 时间限制:10000ms 单点时限:1000ms 内存限制:256MB 描述 上回说到,小Ho得到了一棵二叉树玩具,这个玩具是由小球和木棍连接起来的,而在拆拼它的过程中, ...

  9. OpenWrt 路由器如何让 lan 口主机获得 ipv6 网络访问 -- 知乎

    本文转自知乎: OpenWrt 路由器如何让 lan 口主机获得 ipv6 网络访问? - mistforest的回答 - 知乎https://www.zhihu.com/question/29667 ...

  10. (转)浅谈测试驱动开发(TDD)

    测试驱动开发(TDD)是极限编程的重要特点,它以不断的测试推动代码的开发,既简化了代码,又保证了软件质量.本文从开发人员使用的角度,介绍了 TDD 优势.原理.过程.原则.测试技术.Tips 等方面. ...