链接:

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;
}

Educational Codeforces Round 73 (Rated for Div. 2) C. Perfect Team的更多相关文章

  1. Educational Codeforces Round 73 (Rated for Div. 2)

    传送门 A. 2048 Game 乱搞即可. Code #include <bits/stdc++.h> #define MP make_pair #define fi first #de ...

  2. Educational Codeforces Round 73 (Rated for Div. 2) D. Make The Fence Great Again(DP)

    链接: https://codeforces.com/contest/1221/problem/D 题意: You have a fence consisting of n vertical boar ...

  3. Educational Codeforces Round 73 (Rated for Div. 2) B. Knights(构造)

    链接: https://codeforces.com/contest/1221/problem/B 题意: You are given a chess board with n rows and n ...

  4. Educational Codeforces Round 73 (Rated for Div. 2) A. 2048 Game

    链接: https://codeforces.com/contest/1221/problem/A 题意: You are playing a variation of game 2048. Init ...

  5. Educational Codeforces Round 73 (Rated for Div. 2)F(线段树,扫描线)

    这道题里线段树用来区间更新(每次给更大的区间加上当前区间的权重),用log的复杂度加快了更新速度,也用了区间查询(查询当前区间向右直至最右中以当前区间端点向右一段区间的和中最大的那一段的和),也用lo ...

  6. Educational Codeforces Round 73 (Rated for Div. 2)E(思维,博弈)

    //这道题博弈的核心就是不能让后手有一段只能放b而长度不够放a的段,并且先手要放最后一次#define HAVE_STRUCT_TIMESPEC#include<bits/stdc++.h> ...

  7. Educational Codeforces Round 73 (Rated for Div. 2)D(DP,思维)

    #define HAVE_STRUCT_TIMESPEC#include<bits/stdc++.h>using namespace std;long long a[300007],b[3 ...

  8. Educational Codeforces Round 48 (Rated for Div. 2)G. Appropriate Team

    题意:求满足条件的(i,j)对数:\(gcd(v,a_i)=x,lcm(v,a_j)=y\) 题解:\(x|a_i,a_j|y\),\(x|y\),考虑质因子p,假设a_i中p次数为a,x中次数为b, ...

  9. Educational Codeforces Round 60 (Rated for Div. 2) - C. Magic Ship

    Problem   Educational Codeforces Round 60 (Rated for Div. 2) - C. Magic Ship Time Limit: 2000 mSec P ...

随机推荐

  1. 小结Fragment与FragmentPagerAdapter的生命周期及其关系

    本博客部分内容是来自http://blog.csdn.net/dreamzml/article/details/9951577 FragmentPagerAdapter FragmentPagerAd ...

  2. 剑指offer16:输入两个单调递增的链表,合成后的链表满足单调不减规则。

    1 题目描述 输入两个单调递增的链表,输出两个链表合成后的链表,当然我们需要合成后的链表满足单调不减规则. 2 思路与方法 迭代法:两个链表中较小的头结点作为合并后头结点,之后依次合并两个链表中较小的 ...

  3. 欢迎使用f MWeb

    MWeb 是专业的 Markdown 写作.记笔记.静态博客生成软件,目前已支持 Mac,iPad 和 iPhone.MWeb 有以下特色: 软件本身: 使用原生的 macOS 技术打造,追求与系统的 ...

  4. python3.5+installer 将.py 打包成.exe

    (1)下载安装installer,不如我安装在D:\Program Files\Python35,安装完成后,在D:\Program Files\Python35\Scripts可以找到install ...

  5. Oracle 表分区介绍与使用

    什么是表分区 分区表是将大表的数据分成称为分区的许多小的子集,类型有FAT32,NTFST32,NTFS.另外,分区表的种类划分主要有:range,list,和hash分区.划分依据主要是根据其表内部 ...

  6. JavaScript数组方法之reduce

    又见到数组方法了,在前面已经的多次写到过数组方法,甚至都使用原生方法重构了一遍数组的各个方法,可是随着数组方法reduce的应用,发现reduce真的是妙用无穷啊!还是很值得再拿出来说一遍的. 我们再 ...

  7. SimpleDateFormat线程安全问题

    今天线上出现了问题,从第三方获取的日期为 2019-12-12 11:11:11,通过SimpleDateFormat转换格式后,竟然出现完全不正常的日期数据,经百度,得知SimpleDateForm ...

  8. intellij IDE 破解 简单 License server 法

    http://idea.iteblog.com/key.php

  9. editormd 富文本编辑器转 html

    // html <div id="markdown-view"> <textarea id="markdownView" style=&quo ...

  10. 【js】null 和 undefined的区别?

    1.首先看一个判断题:null和undefined 是否相等     console.log(null==undefined)//true     console.log(null===undefin ...