Educational Codeforces Round 73 (Rated for Div. 2) C. Perfect Team
链接:
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的更多相关文章
- Educational Codeforces Round 73 (Rated for Div. 2)
传送门 A. 2048 Game 乱搞即可. Code #include <bits/stdc++.h> #define MP make_pair #define fi first #de ...
- 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 ...
- 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 ...
- 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 ...
- Educational Codeforces Round 73 (Rated for Div. 2)F(线段树,扫描线)
这道题里线段树用来区间更新(每次给更大的区间加上当前区间的权重),用log的复杂度加快了更新速度,也用了区间查询(查询当前区间向右直至最右中以当前区间端点向右一段区间的和中最大的那一段的和),也用lo ...
- Educational Codeforces Round 73 (Rated for Div. 2)E(思维,博弈)
//这道题博弈的核心就是不能让后手有一段只能放b而长度不够放a的段,并且先手要放最后一次#define HAVE_STRUCT_TIMESPEC#include<bits/stdc++.h> ...
- 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 ...
- 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, ...
- 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 ...
随机推荐
- hisiv100交叉编译工具链安装
hisi交叉编译工具链安装 一. 摘要: 交叉编译简单的说,就是A机器上编译生成,运行在B机器上.那么在A机器上的编译工具安装,就是本文所要描述的内容. 工欲善其事必先利其器,所以交叉 ...
- brew update慢,brew install慢如何解决?
主要是资源访问太慢造成的,替换默认源镜像就行. brew使用国内镜像源 这里用中科大的,另外还有清华的可用 1 2 3 4 5 6 7 8 9 10 # 步骤一 cd "$(brew ...
- Android Stadio导入Android工程项目,只有Edit Configurations的解决办法
这几天导入老的Android工程项目,导入后,也不发红也不报错,但是Run这一项没有可运行的App,就只有一个Edit Configurations.经过查询后,发现运行一下Sync Project ...
- LG P2285 [模板]负环(spfa判负环)
题目描述 寻找一个从顶点1所能到达的负环,负环定义为:一个边权之和为负的环. 输入格式 第一行一个正整数T表示数据组数,对于每组数据: 第一行两个正整数N M,表示图有N个顶点,M条边 接下来M行,每 ...
- 线段树维护动态连续子段HDU1540
题意:http://acm.hdu.edu.cn/showproblem.php?pid=1540 #define IOS ios_base::sync_with_stdio(0); cin.tie( ...
- urllib的简单使用
首先需要导包 Import urllib.request 这是一个简单的网站例如:发起请求Response = urlib.request.urlopen("http://www.baidu ...
- MongoDB环境搭建
MongoDB系列第一课:MongDB简介 MongoDB系列第二课:MongDB环境搭建 MongoDB系列第三课:MongDB用户管理 MongoDB系列第四课:MongoDB数据库.集合.文档的 ...
- win10使用vnc远程到Ubuntu 19.04
主要参考:https://www.cyberciti.biz/faq/install-and-configure-tigervnc-server-on-ubuntu-18-04/ https://ww ...
- OkHttp3 + retrofit2 封装
0.下载文件 1.gradle 添加 compile 'com.squareup.retrofit2:retrofit:2.1.0'compile 'com.squareup.retrofit2:co ...
- 【php设计模式】建造者模式
<?php /** *建造者模式特点: * 1.客户端不必知道产品内部组成的细节,将产品本身与产品的创建过程解耦,使得相同的创建过程可以创建不同的产品对象. * 2.每一个具体建造者都相对独立, ...