主页
试题仓库
题目列表
试题分类
经典教材
竞赛作业
竞赛列表
提交状态
图灵学院
TuringMOOC
图灵书屋
图灵商城
图灵实验室
图灵会员
历史荣誉
支持我们
图灵IDE
用户/排名
AOJ排名
实名认证
请登录
常用链接
AOJ考试平台
老赵的Gitee代码
编译原理模拟考试平台
Java技术手册
FCC网站
菜鸟网
在线工具箱
字节豆包GPT
代码可视化
力扣网
牛客网
洛谷
杭电OJ
CodeForce
隐藏编译器
Problem 1147 --老王赛马
1147: 老王赛马
上一题
正确率: $30.19\%$
下一题
Time Limit
$1$ 秒/Second(s)
Memory Limit
$512$ 兆字节/Megabyte(s)
提交总数
$53$
正确数量
$16$
"
裁判形式
标准裁判/Standard Judge
我的状态
尚未尝试
难度
分类标签
模拟
×
为本题添加算法分类(请不要超过5个)
当前分类(单击移除):
模拟
单击选择分类:
Description
<p><span style="color: rgb(0, 0, 0); font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; " class="Apple-style-span">赛马是一古老的游戏,早在公元前四世纪的中国,处在诸侯割据的状态,历史上称为“战国时期”。在魏国作官的孙膑,因为受到同僚庞涓的迫害,被齐国使臣救出后,到达齐国国都。<span class="Apple-converted-space"> </span><br /> 赛马是当时最受齐国贵族欢迎的娱乐项目。上至国王,下到大臣,常常以赛马取乐,并以重金赌输赢。田忌多次与国王及其他大臣赌输赢,屡赌屡输。一天他赛马又输了,回家后闷闷不乐。孙膑安慰他说:“下次有机会带我到马场看看,也许我能帮你。”<span class="Apple-converted-space"> </span><br /> 孙膑仔细观察后发现,田忌的马和其他人的马相差并不远,只是策略运用不当,以致失败。<span class="Apple-converted-space"> </span><br /> 比赛前田忌按照孙膑的主意,用上等马鞍将下等马装饰起来,冒充上等马,与齐王的上等马比赛。第二场比赛,还是按照孙膑的安排,田忌用自己的上等马与国王的中等马比赛,在一片喝彩中,只见田忌的马竟然冲到齐王的马前面,赢了第二场。关键的第三场,田忌的中等马和国王的下等马比赛,田忌的马又一次冲到国王的马前面,结果二比一,田忌赢了国王。<span class="Apple-converted-space"> </span><br /> 就是这么简单,现在老王也来赛一赛马。假设每匹马都有恒定的速度,所以速度大的马一定比速度小的马先到终点(没有意外!!)。不允许出现平局。最后谁赢的场数多于一半(不包括一半),谁就是赢家(可能没有赢家)。老王有N(1≤N≤1000)匹马参加比赛。对手的马的数量与渊子马的数量一样,并且知道所有的马的速度。聪明的你来预测一下这场世纪之战的结果,看看老王能否赢得比赛。<span class="Apple-converted-space"> <br /> </span></span></p>
Input
<p><span style="color: rgb(0, 0, 0); font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; " class="Apple-style-span">输入有多组测试数据。<span class="Apple-converted-space"> </span><br /> 每组测试数据包括3行:<span class="Apple-converted-space"> </span><br /> 第一行输入N(1≤N≤1000)。表示马的数量。<span class="Apple-converted-space"> </span><br /> 第二行有N个整型数字,即渊子的N匹马的速度。<span class="Apple-converted-space"> </span><br /> 第三行有N个整型数字,即对手的N匹马的速度。<span class="Apple-converted-space"> </span><br /> 当N为0时退出。<span class="Apple-converted-space"> <br /> </span></span></p>
Output
<p><span style="color: rgb(0, 0, 0); font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; " class="Apple-style-span">若通过聪明的你精心安排,如果渊子能赢得比赛,那么输出“YES”。<span class="Apple-converted-space"> </span><br /> 否则输出“NO”。</span></p>
Sample Input
5 2 3 3 4 5 1 2 3 4 5 4 2 2 1 2 2 2 3 1 0
Sample Output
YES NO
推荐代码
查看1147 所有题解
上传题解视频得图灵币
本题记录
用 户(点击查看用户)
运行号(点击购买题解)
时 间
算法最快[$0 $ms]
0
内存最少[$0 $KB]
0
第一AC
0
第一挑战
0
赛题来源
NA
AOJ
Please Login