cf519C. A and B and Team Training(找规律)
题意
$a$个学生,$b$个教练
可以两个学生和一个教练一组,也可以两个教练和一个学生一组,问最多组成多少组
Sol
发题解的目的是为了纪念一下自己的错误思路
刚开始想的是:贪心的选,让少的跟多的分在一组里。事实证明这是错的,比如:500 500。
然后想的是:我们可以把教练和学生看着物品,密度最大应该是最优的,也就是$3$个教练和$3$个学生构成一组,但这样也是错的,比如7 11
又想了很久,发现我们根本就不用管他们是怎么分的,先特判掉$a < 2 * b$的情况,反正三个人一定能分成一组,那直接输出$(a + b) /3$就行了
int a, b;
main() {
a = read(); b = read();
if(a < b) swap(a, b);
if(a > * b) cout << b;
else cout << (a + b) / ;
return ;
}
/*
*/
cf519C. A and B and Team Training(找规律)的更多相关文章
- 294 div2 C. A and B and Team Training
C. A and B and Team Training 题目:A and B are preparing themselves for programming contests. An import ...
- CF A and B and Team Training (数学)
A and B and Team Training time limit per test 1 second memory limit per test 256 megabytes input sta ...
- codeforces 519C.. A and B and Team Training
C. A and B and Team Training time limit per test 1 second memory limit per test 256 megabytes input ...
- Codeforces Round #294 (Div. 2)C - A and B and Team Training 水题
C. A and B and Team Training time limit per test 1 second memory limit per test 256 megabytes input ...
- 2017ACM暑期多校联合训练 - Team 1 1011 HDU 6043 KazaQ's Socks (找规律)
题目链接 Problem Description KazaQ wears socks everyday. At the beginning, he has n pairs of socks numbe ...
- URAL 1780 G - Gray Code 找规律
G - Gray CodeTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hust.edu.cn/vjudge/contest/view ...
- hdu4952 Number Transformation (找规律)
2014多校 第八题 1008 2014 Multi-University Training Contest 8 4952 Number Transformation Number Transform ...
- HDU 5795 A Simple Nim (博弈 打表找规律)
A Simple Nim 题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5795 Description Two players take turns ...
- HDU 5753 Permutation Bo (推导 or 打表找规律)
Permutation Bo 题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5753 Description There are two sequen ...
随机推荐
- 3、python数据类型之字符串(str)
字符串是任何计算机语言中最常见的数据类型,python中也不例外,因此熟练掌握字符串是学习python的必备技能.python中字符串三种定义方式 str = 'wang' str = "w ...
- ACM-ICPC 2018 南京赛区网络预赛 Lpl and Energy-saving Lamps (线段树:无序数组找到第一个小于val)
题意:n个房间,每个房间有ai盏旧灯,每个月可以买m盏新灯,要求:按房间顺序换灯,如果剩下的新灯数目大于ai,那么进行更换,否则跳过该房间,判断下一个房间.如果所有房间都换完灯,那么久不会再买新灯. ...
- APP请求超时问题-ios超时-android超时
最近发现公司的app在高峰期超时严重.用wifi网络一直超时,但qq等却正常.换成手机卡网络正常. 起初以为是DNS解析问题. 后来抓包,发现DNS解析正常,可以得到正确的A记录. 但tcp retr ...
- Caused by: MetaException(message:Hive Schema version 2.1.0 does not match metastore's schema version 1.2.0 Metastore is not upgraded or corrupt)
解决方案汇总: ()删除HDFS上的hive数据与hive数据库 hadoop fs -rm -r -f /tmp/hive hadoop fs -rm -r -f /user/hive ()删除My ...
- 11g 配置 dgmgrl 以及报错 DataGuard ORA-00313,
1参考 https://gavinsoorma.com/2010/03/11g-data-guard-broker-dgmgrl-configuration-quick-steps/ This not ...
- Java面向对象_数据结构之链表
链表:是一种常见的基础数据结构,是一种线性表,但是并不会按线性的顺序存储数据,而是在每一个节点里村到下一个节点的指针. 在链表数据结构中,需要使用到递归算法.递归算法是一种直接或间接地调用自身算法的过 ...
- 精心整理的SQL语句学习大全
-语 句 功 能 --数据操作SELECT --从数据库表中检索数据行和列INSERT --向数据库表添加新数据行DELETE --从数据库表中删除数据行UPDATE --更新数据库表中的数据-数据 ...
- mysql报错this is incompatible with sql_mode=only_full_group_by
1.报错信息 com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: In aggregated query without GROUP ...
- WCF SecurityElement
1.SslStreamSecurityElement <sslStreamSecurity requireClientCertificate="true"/> Requ ...
- java数据结构和算法07(2-3-4树)
上一篇我们大概了解了红黑树到底是个什么鬼,这篇我们可以看看另外一种树-----2-3-4树,看这个树的名字就觉得很奇怪.... 我们首先要知道这里的2.3.4指的是任意一个节点拥有的子节点个数,所以我 ...