Spoj-BIPCSMR16 Team Building
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的更多相关文章
- BZOJ 4742: [Usaco2016 Dec]Team Building
4742: [Usaco2016 Dec]Team Building Time Limit: 10 Sec Memory Limit: 128 MBSubmit: 21 Solved: 16[Su ...
- CF1316E Team Building
CF1316E [Team Building] 状压dp,感觉比D简单 \(f[i][s]\),表示考虑前\(i\)个人,状态为\(s\)(\(s\)的第\(j-1\)个二进制位表示队员的第\(j\) ...
- BZOJ4742 : [Usaco2016 Dec]Team Building
如果我们将两个人拥有的牛混在一起,并按照战斗力从小到大排序,同时把第一个人选的牛看成$)$,第二个人选的牛看成$($的话,那么我们会发现一个合法的方案对应了一个长度为$2k$的括号序列. 于是DP即可 ...
- 1742. Team building(dfs)
1742 最小的是找联通块数 最大的找环 一个环算一个 其它的数各算一个 #include <iostream> #include<cstdio> #include<cs ...
- [USACO 2016Dec] Team Building
[题目链接] https://www.lydsy.com/JudgeOnline/problem.php?id=4742 [算法] 动态规划 用Fi,j,k表示约翰的前i头牛和保罗的前j头牛匹配 , ...
- [Exchange 2013]创建约会和会议
简介 会议和约会之间的重要区别是,会议有与会者,并且没有约会.约会和会议可以是单实例或属于重复序列,但与会者. 房间或资源中不包括约会,因为它们不需要发送一条消息.在内部,Exchange 使用相同的 ...
- 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 ...
- 基于AWS的云服务架构最佳实践
ZZ from: http://blog.csdn.net/wireless_com/article/details/43305701 近年来,对于打造高度可扩展的应用程序,软件架构师们挖掘了若干相关 ...
- SCRUM站立会议
SCRUM站立会议是让团队成员每日面对面站立互相交流他们所承担任务的进度.它的一个附带好处是让领导或经理能了解 到工作情况.本质上是为了团队交流,不是报告会议! 功能: 1)创造团队成员相互沟通的条件 ...
随机推荐
- codevs 1131 统计单词数 2011年NOIP全国联赛普及组
时间限制: 1 s 空间限制: 128000 KB 题目等级 : 白银 Silver 题目描述 Description 一般的文本编辑器都有查找单词的功能,该功能可以快速定位特定单词在文章中的位 ...
- nginx 编译某个模板的问题./configure: error: SSL modules require the OpenSSL library. You can either do not enable the modules, or install the OpenSSL library into the system, or build the OpenSSL library stati
root@hett-PowerEdge-T30:/usr/local/src/nginx-1.9.8# ./configure --prefix=/usr/local/nginx --add-mod ...
- SAP成都研究院郑晓霞:Shift Left Testing和软件质量保证的一些思考
今天的文章来自Jerry的同事,曾经的搭档郑晓霞(Zheng Kate).郑晓霞是在Jerry心中是一位很有实力的程序媛,2011年从西安某软件公司跳槽到SAP成都研究院.当时,成都研究院的CRM团队 ...
- 迅为IMX6Q开发板在道路交通信号控制系统解决方案中的应用
智能交通综合管控平台是为交通指挥系统服务的统一信息平台,以信息技术为主导,以计算机通信网络和智能化指挥控制管理为基础,建成集高新技术应用为一体的智能化指挥调度集成平台,实现信息交换与共享.快速反应决策 ...
- php日期时间和时间戳转化
echo date("Y-m-d H:i:s", 1409138643);echo strtotime('2014-08-28 23:00:00');
- UVA 11400 Lighting System Design 照明系统设计
首先是一个贪心,一种灯泡要么全都换,要么全都不换. 先排序,定义状态d[i]为前面i种灯泡的最小花费,状态转移就是从d[j],j<i,加上 i前面的j+1到i-1种灯泡换成i的花费. 下标排序玩 ...
- 2.add two number
在初始化的时候:ListNode* result;这样就会报runtime error
- Linux系统分区 进程管理 软件包安装
对于一块新的磁盘来说,系统能够使用需要有分区.格式化文件系统.挂载等主要操作,下面通过命令的方式对一块磁盘进行操作. 一. Linux系统分区 1.1 在虚拟机开机前选择虚拟机配置,添加一个新的SCS ...
- HTTP协议详解-基础知识
HTTP是一个属于应用层的面向对象的协议,由于其简捷.快速的方式,适用于分布式超媒体信息系统.绝大多数的Web开发,都是构建在HTTP协议之上的Web应用. HTTP协议的主要特点可概括如下: 简单: ...
- JavaScript正则表达式-字符类
字符列表 在方括号内指定一个或者多个字符组成的字符列表,与字符列表中任意字符匹配,都被认为是匹配的.每次匹配只能匹配列表中的一个字符. str = "bird,head,fed,meadow ...