编程介的小学生 2019-04-09 10:29 采纳率: 20.5%
浏览 205

三元组的数据结构的设计的一个算法的问题的方式,怎么利用c程序的语言的技术来做?

An archaeologist want to enter the King's Tomb of a pyramid. But there is a very very long corridor known as the Death Corridor which connects the entrance of the pyramid and the King's Tomb. In order to successfully enter the King's Tomb and avoid death, the archaeologist has got an ancient map about this corridor.

First, on this map, the corridor is marked with many numbers indicating the position in the corridor. At the middle of the corridor, namely, the position with Index 0, there is a detector. Anyone who comes at the middle of the corridor or passes it will activate the protection system of the corridor. When the protection system is activated, some poisonous arrows will come out from the wall of the corridor and kill the intruder.

But the arrows do not come out all the time and altogether, they will follow such rules:
1. If at time T the intruder is at position P, then at time T+A, at all the positions to the right of position P(and including P) arrows will come out(We define the direction to the King's Tomb the right direction).
2. If at time T the intruder is at position P, then at time T+B, at all the positions to the left of position P(and including P) arrows will come out(We define the dirction to the entrance of the pyramid the left direction).
3. Suppose the time when the intruder arrives at the middle of the corrider and activates the protection system is 0, then after N units time(i.e. from time N+1 on) the system will automatically deactivate(the arrows won't come out any more) because the ancient designer of the pyramid thought the intruder is sure to die after N units time.

Will the archaeologist successfully pass the Death Corridor? He turns to you for help. You are asked to find out whether there is a method to avoid death or the archaeologist is destined to die if he insists on going into the pyramid. Suppose the corridor is long enough and the the archaeologist run fast enough(i.e. he can run any number of unit length to the left or right in one unit time but not come out of the corridor).

Input:

There are multiple test cases! Each test case possess a line with three integers N,A,B described above(0<A,B<=N<=20000).

Output:

For each test case, if the archaeologist can successfully pass the Death Corridor, output "Yes" in a line first. Then on the next N lines output how the archaeologist should go from time 0 to time N-1. If the archaeologist should go left S unit length at time T, output on the corresponding line "Left S". Similarly, if the archaeologist should go right S unit length at time T, output on the corresponding line "Right S". Else if the archaeologist should stay at the same position, simply output on the corresponding line "Stay". If there are multiple solutions, output any one. But if the archaeologist cannot pass the corridor, just output one line containing "No".

Sample Input:
2 1 1
3 2 3

Sample Output:
No
Yes
Right 2
Left 3
Right 2

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥88 找成都本地经验丰富懂小程序开发的技术大咖
    • ¥15 如何处理复杂数据表格的除法运算
    • ¥15 如何用stc8h1k08的片子做485数据透传的功能?(关键词-串口)
    • ¥15 有兄弟姐妹会用word插图功能制作类似citespace的图片吗?
    • ¥200 uniapp长期运行卡死问题解决
    • ¥15 请教:如何用postman调用本地虚拟机区块链接上的合约?
    • ¥15 为什么使用javacv转封装rtsp为rtmp时出现如下问题:[h264 @ 000000004faf7500]no frame?
    • ¥15 乘性高斯噪声在深度学习网络中的应用
    • ¥15 关于docker部署flink集成hadoop的yarn,请教个问题 flink启动yarn-session.sh连不上hadoop,这个整了好几天一直不行,求帮忙看一下怎么解决
    • ¥15 深度学习根据CNN网络模型,搭建BP模型并训练MNIST数据集