RunningMan FZU - 2221 (思维!!)

福州大学第十五届程序设计竞赛题解 E - 谁还不是个宝宝 题目链接 http://acm.fzu.edu.cn/problem.php?pid=2288 题解 求奇数中位数区间,这种方法值得记录。 代码 #include <iostream> #include <cstdio> #include <cstring> #include <cmath> using n... 阅读详情

RunningMan

FZU - 2221

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.

【题意】
两个队伍(其中一队为RunningMan)进行三轮制比赛

比赛规则如下:

①每轮比赛中,人数较多的一方获胜,人数相同时算RunningMan这队获胜

②参赛的每个人最多只能参加一轮比赛

③比赛采取三局两胜制,即赢了两轮比赛的队伍获胜

④三轮比赛的人数安排必须在总的比赛开始前给出,且不能更换

⑤显然,比赛开始前,每一队都不知道对方的人数安排情况

现在已知RunningMan队有n个人,另一队有m个人,问RunningMan队是否必定能够获得比赛最终的胜利

【类型】
思维考查

【分析】

那么,在不知道对手如何安排人数的前提下,要想必胜,RunningMan的唯一选择就是每轮上场人数相同

这样就能应付对手可能安排某一轮人数多,某一轮人数少的情况,使得就算让对手赢也不能赢得太轻松,要尽可能地消耗对方人数

所以我们暂时假设RunningMan每轮上场人数为k


这就相当于,即便对手知道RunningMan队如何安排人数,但依旧是输

而我们之前已经知道RunningMan每轮上场人数为k

那对手要赢就要做到至少两场人数为k+1,更明智的,对手会放弃一轮,而把己方所有人投到某两轮中放手一搏

考虑到人是无法分割的整体,因此,我们对对手方的人数m进行奇偶性分类讨论:

⒈当m为偶数时,因为RunningMan队是平均分配人数的,所以对手方两轮人数分别为k,k(m=k+k,就算不是k,k也不要紧,后面接着分析)

此时RunningMan要想必定获胜且用的总人数最少,人数安排应该是k,k,k-1

所以n的人数最少应该是3k-1,即n >= 3k-1,因为m是偶数所以k = m/2  所以这种情况应该是n >= m / 2 * 3 - 1

这样的话,对手最多可以赢一场,即k>k-1,然后对手只剩k个人,无法赢另外两场,显然对手不会花更多的人去赢k-1的这轮,人越多越浪费

⒉当m为奇数时,对手方人数安排为k,k-1(m=k+k-1)

那么,RunningMan的人数安排为k-1,k-1,k-1就足够了

所以这种情况下n >= 3 * (k-1) 因为m是奇数所以 m / 2 = k-1,所以n >= m / 2 * 3

code:

#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
int main(){
    int t,n,m;
    scanf("%d",&t);
    while(t--){
        scanf("%d%d",&n,&m);
        if(m % 2 == 1 && n >= m / 2 * 3 || m % 2 == 0 && n >= m / 2 * 3 - 1)
            puts("Yes");
        else
            puts("No");
    }
    return 0;
}


从 VS Code 创建 ABAP Development Objects,包、命名、传输请求和 Clean Core 的一条线打通 文章摘要: SAP ABAP开发工具正从传统SAP GUI/Eclipse向VS Code迁移,通过ABAP Development Tools扩展实现代码编辑、调试和传输管理。文章重点分析了创建ABAP对象背后的治理逻辑:1)对象创建涉及包结构、命名规范、传输层等关键设计决策;2)VS Code通过命令面板(Ctrl+Shift+P)提供统一创建入口;3)对象类型选择反映架构意图,应从业务模型角度规划;4)Package是重要的治理边界,需按业务能力分区;5)命名和描述需体现业务语义;6)传输请求标记对象 阅读详情

相关推荐

基于Ardupilot/PX4固件,APM/PIXhawk硬件的VTOL垂直起降固定翼软硬件参数调试(第一篇)安装调试

基于Ardupilot/PX4固件,APM/PIXhawk硬件的VTOL垂直起降固定翼调试 本文内容大部分来自Kris,我们的K大,在VTOL领域的大牛,在此,非常感谢K大。能引用K大的成果也是自己的荣幸,不便之处还请K大多多包涵,在此引用只是为方便自己日常学习,部分参数表里根据自身情况,增加了相应参数。 1.安装及下载Ardupilot官方固件: VTOL固件的来源可分为Ardupilot官方固...

u011322358的博客 3万+

第六届福建省大学生程序设计竞赛(FZU2212—FZU2221)

Super Mobile Charger 题目链接: http://acm.fzu.edu.cn/problem.php?pid=2212 解题思路: 水题。 AC代码: #include #include #include using namespace std; int a[105]; int main(){ int T; scanf("%d",&T)

piaocoder 2434

Codesys电子凸轮Cam表实战:从可视化配置到程序化构建

本文详细介绍了Codesys电子凸轮Cam表的实战应用,从可视化配置到程序化构建的全过程。通过包装机和印刷机案例,解析Cam表的基础设置、调试技巧及动态构建方法,帮助工程师快速掌握电子凸轮技术,提升运动控制精度和效率。

weixin_29309785的博客 297

第六届福建省大学生程序设计竞赛不完全题解

昨天自己队做了一下第六届福建省赛,感觉有些蒙,赛后补了几道题,能力有限,一共只出A了7道题 A题 Super Mobile Charger 题目链接 http://acm.fzu.edu.cn/problem.php?pid=2212 水题 #include<iostream> #include<cstdio> #include&l...

Dara2015的博客 692

【现代信号处理】01 -概率论与随机过程回顾

概率论与随机过程回顾 文章目录概率论与随机过程回顾1. 统计模型的相关概念1.1 统计实验(不确定性)1.2 样本点1.3 样本空间Ω1.4 概率1.5.统计模型是先验的2. 概率和统计的差异2.1 联系2.2 差异2.3.1 概率和统计问题的三要素2.3.1.1 model-模型2.3.1.2 data-数据2.3.1.3 decision-决策2.3.2 关系图3. 样本空间的重要性3.1 贝朗特悖论3.1.1 解法一3.1.2 解法二3.1.3 解法三3.2 结论4.概率相关的概念4.1 随机变量4.

qq_41741344的博客 1405

folium离线地图实战:从下载到部署的完整指南

本文提供了一份完整的folium离线地图实战指南。针对网络不稳定或内网环境下的地图应用需求,详细讲解了如何下载离线地图瓦片数据,并通过两种核心方法(直接替换URL与创建TileLayer)将其集成到folium中。文章还涵盖了部署优化、边界处理及资源本地化等关键步骤,帮助你构建完全脱离网络依赖的交互式地图应用。

weixin_29061041的博客 274

FZU Problem 2221 RunningMan(思维考查)——第六届福建省大学生程序设计竞赛-重现赛

FZU Problem 2221 RunningMan(思维考查)——第六届福建省大学生程序设计竞赛-重现赛

queuelovestack的专栏 1409

通义千问AI模型对接飞书机器人-集成飞书机器人(2-2)

http请求地址上一篇百炼平台配置的应用地址。

hefaji的博客 1916

第六届福建省大学生程序设计竞赛-重现赛

A - Super Mobile Charger FZU - 2212 While HIT ACM Group finished their contest in Shanghai and is heading back Harbin, their train was delayed due to the heavy snow. Their mobile phones

jade的博客 574

【LLC快速上手系列】LLC轻载时:开关频率 + 死区时间 联合优化!

轻载优化,频率别飞天,死区要有耐心。两手一起抓,效率高到笑。😎。

weixin_43199439的博客 1182

小红书直播弹幕采集

本文主要介绍小红书直播间弹幕的采集,便于进行直播数据监控与直播数据进行分析。

tdl320721的博客 2539

FZOJ--2221-- RunningMan(水题)

Problem 2221 RunningMan Accept: 4    Submit: 10 Time Limit: 1000 mSec    Memory Limit : 32768 KB Problem Description ZB loves watching RunningMan! There's a game in RunningMan calle

playboy307 1726

OV9734 DATASHEET,完整规格书

OV9734完整规格书,包括电气参数,尺寸规格,寄存器配置表等

fzu 2221 Running man 数学 思维

思路:在给定两队人数的情况下,三局两胜制,相同人数下runningman获胜,无论对手怎么安排,问runningman会不会胜利。假设对方的人数是m,分为奇数偶数两种情况讨论。极端情况下,对方用0去对待runningman人数最多的一次。剩下两局中runningman要赢一局。对方安排  --- 0 , x , y ,x&gt;=y.man        --- a , b , c ,a&gt;=...

Peppermint__的博客 517

复分析 阿尔福斯(Ahlfors) 第三版答案 英文

答案分为十章,有部分习题没有答案,全英文复分析阿尔福斯(Ahlfors) 第三版答案

android 蓝牙通讯demo

android 下蓝牙通讯demo,实现了发现蓝牙,使能蓝牙,通过蓝牙发送消息。

J - RunningMan FZU - 2221

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

海绵的博客 248

NTscan扫描工具

ntscan是一个扫描器,可以扫描没有密码和弱密码的共享,先到配置文件中填写猜测的用户名和密码,扫描过程中右侧出现的是扫描日志。

FZU2221 RunningMan(思维 线性规划)

题目大意:T组测试样例,接下来两个整数,表示正方和反方的人数,有三局比赛,问如何安排各自的人数使得正方必赢,并且正方存在一种安排策略使得反方无论如何都无法赢就输出Yes,否则输出No。同一个人只能参加一局,一局中如果正方人数不小于反方则算正方该局赢,参与三局两胜制。 思路:每局可以不派人,如果正方存在的最优策略一定是平均把人数分配到三局游戏中,而反方想赢就必须把人数集中到其中两局,并且这两局都要赢...

小胡同的诗 202

第六届福建省大学生程序设计竞赛 Problem J RunningMan【数学】

Problem J RunningMan   Accept: 123    Submit: 551 Time Limit: 1000 mSec    Memory Limit : 32768 KB Problem Description ZB loves watching RunningMan! There's a game in RunningMan called 100 vs 10...

小I的博客 1618

FZU 2221 RunningMan

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 te

Waves___的博客 553

RunningMan【第六届福建省大学生程序设计竞赛-重现赛】

RunningMan Time Limit: 1000ms Memory Limit: 32768KB This problem will be judged on FZU. Original ID: 2221 64-bit integer IO format: %I64d      Java class name: Main Prev  Submit St

ACMer_Shadow的博客 2489

FOJ Problem 2221 RunningMan

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 te

ShiWaiGaoRen12345的博客 950

第九届福建省大学生程序设计竞赛-重现赛(感谢承办泉州师范学院)

In the distant space, there is a technologically advanced planet. One day they provided the Earth with a code that could achieve the ultimate meaning of the universe. People were very happy, but foun...

loooooog的博客 1130

第六届福建省大学生程序设计竞赛

弱就做出5道题。 A题: B题: C题: D题:

世界很大 1467

FZU2221 分组必胜

题目大意:给定跑男团和敌方人数n,m,每队分成3组,相互pk,人数多则胜利,问跑男团是否必胜 思路:因为跑男团必胜,所以必须有两个组大于等于敌方队伍人数,第一次派出敌方一半的人去,如果对方想胜利,则必须大于一半,剩下的人数为小于一半,跑男团只需要在派一半或者一半减一,则必胜。如果第一次地方队伍输了,假设地方队伍没有派人,那么跑男团第二次同样派出敌方一半人数,同理,最后一次只需要一半减一,这种情况

风一样的自由,色彩斑斓的雨季 629

第六届福建省大学生程序设计竞赛-重现赛,Problem B Common Tangents【数学几何】

Problem B Common Tangents Accept: 191    Submit: 608 Time Limit: 1000 mSec    Memory Limit : 32768 KB  Problem Description Two different circles can have at most four common tangents. The

平平淡淡才是真 1040

第九届福建省大学生程序设计竞赛 部分题解

A题:FZU 2294 这题是无符号的计算,但是有个坑就是我用printf输出一直wa,用cout输出就AC。 #include&lt;cstdio&gt; #include&lt;iostream&gt; #include&lt;cstring&gt; #include&lt;string&gt; #include&lt;algorithm&gt; #include&lt;map&gt; ...

ccsu_cat 2136

leetcode224. Basic Calculator

Implement a basic calculator to evaluate a simple expression string. The expression string may contain open ( and closing parentheses ), the plus + or minus sign -, non-negative integers and empty spac

大锅八十小锅四十 429

Uint47 calculator【map数组+快速积+各种取余公式】

Uint47 calculator 题目链接(点击) In the distant space, there is a technologically advanced planet. One day they provided the Earth with a code that could achieve the ultimate meaning of the universe. Pe...

XJHui 369
上一篇: Chess For Three (模拟)
下一篇: Knapsack problem FZU - 2214 (01背包变形)
Guuuuuu老师儿
博客等级 码龄9年 259粉丝 718原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值