题意

$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(找规律)的更多相关文章

  1. 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 ...

  2. 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 ...

  3. 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 ...

  4. 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 ...

  5. 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 ...

  6. URAL 1780 G - Gray Code 找规律

    G - Gray CodeTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hust.edu.cn/vjudge/contest/view ...

  7. hdu4952 Number Transformation (找规律)

    2014多校 第八题 1008 2014 Multi-University Training Contest 8 4952 Number Transformation Number Transform ...

  8. HDU 5795 A Simple Nim (博弈 打表找规律)

    A Simple Nim 题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5795 Description Two players take turns ...

  9. HDU 5753 Permutation Bo (推导 or 打表找规律)

    Permutation Bo 题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5753 Description There are two sequen ...

随机推荐

  1. 牛客练习赛41D(思维转化)

    AC通道 要点 思路:题解中将所求进行转化\[max\{相似度\} = max\{M-不相似度\} = M-min\{不相似度\}\]因此转化为求某01串T与所给众S串的最小不相似度,而最终答案是选取 ...

  2. 1093 Count PAT's(25 分)

    The string APPAPT contains two PAT's as substrings. The first one is formed by the 2nd, the 4th, and ...

  3. mybatis深入理解(一)之 # 与 $ 区别以及 sql 预编译

    mybatis 中使用 sqlMap 进行 sql 查询时,经常需要动态传递参数,例如我们需要根据用户的姓名来筛选用户时,sql 如下: select * from user where name = ...

  4. 03-----body标签中的相关标签

    今日主要内容: 列表标签 <ul>.<ol>.<dl> 表格标签 <table> 表单标签 <form> 一.列表标签 1.无序列表< ...

  5. Hive项目实战:用Hive分析“余额宝”躺着赚大钱背后的逻辑

    一.项目背景 前两年,支付宝推出的“余额宝”赚尽无数人的眼球,同时也吸引的大量的小额资金进入.“余额宝”把用户的散钱利息提高到了年化收益率4.0%左右,比起银行活期存储存款0.3%左右高出太多了,也正 ...

  6. HDU 5452——Minimum Cut——————【树链剖分+差分前缀和】ACdream 1429——Diversion——————【树链剖分】

    Minimum Cut Time Limit: 3000/2000 MS (Java/Others)    Memory Limit: 65535/102400 K (Java/Others)Tota ...

  7. FormsAuthentication IsAuthenticated一直为false

    解决办法: 在Web.Config中添加一下红框的内容

  8. ubuntu下编译安装mysql记录

         搞了整整一天,好不容易折腾完,在此记录下,下次就省事了.     去官网http://www.php.net/downloads.php下载所需要的php版本,这里我选择5.6.22.    ...

  9. npm安装使用淘宝代理的方法(设置registry参数)

    公司防火墙问题导致 npm下载失败,安装使用cnpm不知道什么原因抽筋, 还有一个简单的办法,就是npm安装模块时,设置代理: npm install -g vue-cli --registry=ht ...

  10. 洛谷 P1281 书的复制

    书的复制 Code: #include <iostream> #include <cstdio> #include <cstring> using namespac ...