一个网格的搜索遍历思想的算法问题怎么用C语言的编程技术的实现

Problem Description
Hemisphere Network is the largest television network in Tumbolia, a small country located east of South America (or south of East America). The most popular sport in Tumbolia, unsurprisingly, is soccer; many games are broadcast every week in Tumbolia.

Hemisphere Network receives many requests to replay dubious plays; usually, these happen when a player is deemed to be offside by the referee. An attacking player is offside if he is nearer to his opponents' goal line than the second last opponent. A player is not offside if
●he is level with the second last opponent or
●he is level with the last two opponents.

Through the use of computer graphics technology, Hemisphere Network can take an image of the field and determine the distances of the players to the defending team's goal line, but they still need a program that, given these distances, decides whether a player is offside.

Input
The input file contains several test cases. The first line of each test case contains two integers A and D separated by a single space indicating, respectively, the number of attacking and defending players involved in the play (2 <= A,D <= 11). The next line contains A integers Bi separated by single spaces, indicating the distances of the attacking players to the goal line
(1 <= Bi <= 104). The next line contains D integers Cj separated by single spaces, indicating the distances of the defending players to the goal line (1 <= Cj <= 104). The end of input is indicated by A = D = 0.

Output
For each test case in the input print a line containing a single character: "Y"(uppercase) if there is an attacking player offside, and "N"(uppercase) otherwise.

Sample Input
2 3
500 700
700 500 500
2 2
200 400
200 1000
3 4
530 510 490
480 470 50 310
0 0

Sample Output
N
Y
N

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问

相似问题

1
Mysql数据库表或者excel表格中某两列的修改
2
Unity中,一个不规则的山体,我怎么获取山体表面的Position,mesh网格碰撞都不好用.
1
如何计算一条线过哪几个网格
2
如何计算一个多边形与哪些网格相交
2
网格的铺设问题,怎么解决呢?用C语言实现
1
关于一个C#的llistview问题
2
信息学竞赛题,小学组,你不一定会做!题目:小猫希望获得奖品的总值最大是多少?
0
m x n的网格整数的倒排序,顺序表的实例应用,如何采用C语言实现的呢?
0
圆在网格中的旋转平移的集合问题,怎么采用C语言的算法实现的
0
一个网格搜索的方式,如何采用C语言和深度搜索的方式来实现,运用的数据结构
0
方向编号,然后计算网格路径的问题,用到搜索算法,怎么利用C语言实现
0
一个数据结构里面出现的网格的涂色的问题,怎么才能利用C语言的方式计算呢
0
网格的高度的计算的方式,采用C语言编程的实现的思路怎么实现
0
沿着网格移动,只能向下向右,一个移动路径的算法,采用C语言实现
1
threejs导入的obj模型怎样把网格面转换为曲面?
0
黑白网格棋盘绘制的一个算法数据结构,采用C语言编程的形式
0
方块在网格里的排列的算法问题,这个问题的C语言编程的解答的方式
0
求大佬帮助,我不知道我是不是有那种情况没考虑到,到OJ上提交显示答案错误(本人c语言菜鸟)?
0
虚幻4怎么用C++代码放置一个可破坏静态网格物体
0
交错数组网格计算位置的问题,运用C语言的正确的做法怎么实现?