链接:

https://codeforces.com/contest/1221/problem/C

题意:

You may have already known that a standard ICPC team consists of exactly three members. The perfect team however has more restrictions. A student can have some specialization: coder or mathematician. She/he can have no specialization, but can't have both at the same time.

So the team is considered perfect if it includes at least one coder, at least one mathematician and it consists of exactly three members.

You are a coach at a very large university and you know that c of your students are coders, m are mathematicians and x have no specialization.

What is the maximum number of full perfect teams you can distribute them into?

Note that some students can be left without a team and each student can be a part of no more than one team.

You are also asked to answer q independent queries.

思路:

将c, m变成min(c, m), 多的加到x中, 先得到min(c, x),如果x大, 那么答案不可能用x剩下的组合.

如果c大, 因为剩下的c=m所以可以继续使用.

或者不改变直接二分判断答案也可以

代码:

#include <bits/stdc++.h>
using namespace std; int main()
{
int t, a, b, c;
cin >> t;
while (t--)
{
cin >> a >> b >> c;
if (a < b)
swap(a, b);
c += (a-b);
a = b;
int sum = min(a, c);
a -= sum, b -= sum, c -= sum;
cout << sum+(a+b)/3 << endl;
} return 0;
}

最新文章

  1. 输入三个数a,b,c,要示按由小到大的顺序输出
  2. MySQL 5.6 my.cnf 模版
  3. programing Python --Sys module
  4. Objective-C运行时编程 - 方法混写 Method Swizzling
  5. mutable和volatile关键字
  6. [itint5]棋盘漫步
  7. 将FAT32格式转换成NTFS格式命令
  8. web项目跨域访问
  9. CSS垂直翻转与水平翻转
  10. /*+ hint*/用法,该如何解决
  11. 【Ray Tracing The Next Week 超详解】 光线追踪2-6 Cornell box
  12. js 引擎 和 html 渲染引擎
  13. sql 导入导出表数据 命令
  14. ArcGIS Pro 切割打印
  15. 【leetcode 简单】 第七十三题 丑数
  16. C#剪切板
  17. 垃圾收集(GC)中如何确定哪些内存是&quot;垃圾
  18. Linux 系统使用 iso 镜像文件或光盘配置本地YUM 源的最简单方式
  19. 修改 Input placeholder 的样式
  20. vim之vundle

热门文章

  1. new pdo 连接很慢的原因和解决办法
  2. SQL SERVER 字符串函数 STRING_SPLIT()
  3. 【AtCoder】AGC008
  4. LASSO回归与L1正则化 西瓜书
  5. ReLeQ:一种自动强化学习的神经网络深度量化方法
  6. MySQL 官方样板数据库sakila
  7. QQ浏览器、搜狗浏览器等兼容模式下,Asp.NetCore下,Cookie、Session失效问题
  8. C语言 读取配置文件
  9. Vue大概知识体系和学习参考
  10. 初学java4 编译器优化