Problem 2221 RunningMan

Accept: 17    Submit: 52
Time Limit: 1000 mSec    Memory Limit : 32768 KB

 Problem Description

ZB loves watching RunningMan! There's a game in RunningMan called 100 vs 100.

There are two teams, each of many people. There are 3 rounds of fighting, in each round the two teams send some people to fight. In each round, whichever team sends more people wins, and if the two teams send the same amount of people, RunningMan team wins. Each person can be sent out to only one round. The team wins 2 rounds win the whole game. Note, the arrangement of the fighter in three rounds must be decided before the whole game starts.

We know that there are N people on the RunningMan team, and that there are M people on the opposite team. Now zb wants to know whether there exists an arrangement of people for the RunningMan team so that they can always win, no matter how the opposite team arrange their people.

 Input

The first line contains an integer T, meaning the number of the cases. 1 <= T <= 50.

For each test case, there's one line consists of two integers N and M. (1 <= N, M <= 10^9).

 Output

For each test case, Output "Yes" if there exists an arrangement of people so that the RunningMan team can always win. "No" if there isn't such an arrangement. (Without the quotation marks.)

 Sample Input

2
100 100
200 100

 Sample Output

No
Yes

 Hint

In the second example, the RunningMan team can arrange 60, 60, 80 people for the three rounds. No matter how the opposite team arrange their 100 people, they cannot win.

 Source

第六届福建省大学生程序设计竞赛-重现赛(感谢承办方华侨大学)

 
题目大意:给你两个数,代表R,O两组的总人数n,m,现在玩三轮游戏,三局两胜,如果R组派出的人数大于等于本轮O组派出的人数,那么R组获胜,否则O组获胜,问你是否存在一种安排,不论O组怎么派队,R组都胜利。存在即输出Yes,否则输出No。
 
解题思路:现在将R组分为3队,人数为x,y,z。那么如果满足题意,则R组中每两个队伍都必须获胜,另外一队必输。
需同时满足: x+y >= m-1    表示:x,y两队胜,z队输。z队队员0个人跟O组除了跟x,y对战的另一队人数为1人对战,失败。
       x+z >= m-1
       y+z >= m-1 且 x+y+z = n
联立方程组,解得 n >= 3*(m-1)/2
 
#include<stdio.h>
#include<algorithm>
#include<string.h>
using namespace std;
int main(){
int T,n,m;
scanf("%d",&T);
while(T--){
scanf("%d%d",&n,&m);
if(n >= 1.5*(m-1)){
puts("Yes");
}else{
puts("No");
}
}
return 0;
}

  

 
 

FZU 2221—— RunningMan——————【线性规划】的更多相关文章

  1. FZU 2221 RunningMan(跑男)

    Problem Description 题目描述 ZB loves watching RunningMan! There's a game in RunningMan called 100 vs 10 ...

  2. Problem 2221 RunningMan(fuzoj)

     Problem 2221 RunningMan Accept: 130    Submit: 404Time Limit: 1000 mSec    Memory Limit : 32768 KB ...

  3. FZU Problem 2221 RunningMan(贪心)

    一开始就跑偏了,耽误了很长时间,我和队友都想到博弈上去了...我严重怀疑自己被前几个博弈题给洗脑了...贪心的做法其实就是我们分两种情况,因为A先出,所以B在第一组可以选择是赢或输,如果要输,那直接不 ...

  4. D - 下个也是签到题 FZU - 2221(博弈)

    ZB loves watching RunningMan! There's a game in RunningMan called 100 vs 100. There are two teams, e ...

  5. FZOJ--2221-- RunningMan(水题)

    Problem 2221 RunningMan Accept: 4    Submit: 10 Time Limit: 1000 mSec    Memory Limit : 32768 KB Pro ...

  6. FZU 2137 奇异字符串 后缀树组+RMQ

    题目连接:http://acm.fzu.edu.cn/problem.php?pid=2137 题解: 枚举x位置,向左右延伸计算答案 如何计算答案:对字符串建立SA,那么对于想双延伸的长度L,假如有 ...

  7. FZU 1914 单调队列

    题目链接:http://acm.fzu.edu.cn/problem.php?pid=1914 题意: 给出一个数列,如果它的前i(1<=i<=n)项和都是正的,那么这个数列是正的,问这个 ...

  8. ACM: FZU 2105 Digits Count - 位运算的线段树【黑科技福利】

     FZU 2105  Digits Count Time Limit:10000MS     Memory Limit:262144KB     64bit IO Format:%I64d & ...

  9. FZU 2112 并查集、欧拉通路

    原题:http://acm.fzu.edu.cn/problem.php?pid=2112 首先是,票上没有提到的点是不需要去的. 然后我们先考虑这个图有几个连通分量,我们可以用一个并查集来维护,假设 ...

随机推荐

  1. VS Code 运行html文件

    用VS Code编写html文件,想在VS Code中直接打开运行,配置如下: 配置tasks.json 打开VS Code,点击"终端",选择"配置任务". ...

  2. Kotlin 字符模板

    Kotlin的字符模板和c语言的格式化输出有点像. 先来说说Kotlin 的字符模板怎么弄. fun main(args:Array<String>) { var name="T ...

  3. 1222: FJ的字符串 [水题]

    1222: FJ的字符串 [水题] 时间限制: 1 Sec 内存限制: 128 MB 提交: 92 解决: 20 统计 题目描述 FJ在沙盘上写了这样一些字符串: A1  =  “A” A2  =   ...

  4. Django 错误:TypeError at / 'bool' object is not callable

    使用 Django自带的 auth 用户验证功能,编写函数,使用 is_authenticated 检查用户是否登录,结果报错: TypeError at / 'bool' object is not ...

  5. 【AOP】基于@Aspect的AOP配置

    基于spring cloud的aop配置 1,启动类MemberAppliaction增加注解 @Import({SwaggerConfiguraion.class, WebMvcAutoConfig ...

  6. 流水的算法,铁打的损失函数/MLE

    机器学习算法可以说是不少的,如果死记硬背的话,只能当时记得推导过程和步骤,过一段时间就又想不起来了,只能依稀记得一些影子.所以,应该找到算法的一些通用的方法来理解算法的思路以及推导过程. 我认为,最大 ...

  7. 自动判断PC端、手机端跳往不同的域名JS实现代码

    输入相同域名,在pc端和移动端会出现不同的页面效果,一种是用栅格系统实现自适应, 更多的是设计两套不同的模板和两个二级域名或者一个主域名和一个二级域名(就是有区别就可以了); js代码判断浏览器的用户 ...

  8. bdd相关整理介绍

    BDD介绍 什么是BDD Behavior-driven development In software engineering, behavior-driven development (BDD) ...

  9. eazyui 或bootstrap table表格里插入图片,点击查看大图

    columns: [ {field: 'state',checkbox: true,align: 'center',valign: 'middle'}, {field: 'contacts',sort ...

  10. web 服务器安全防范

    apache 关闭目录 配置文件:安装目录/Apache/conf/httpd.conf <Directory /> #默认就会把/ 的目录暴漏出来:关闭方法: Options -Inde ...