编程介的小学生 2017-12-05 15:08 采纳率: 20.5%
浏览 860
已采纳

Jammed Traffic

Problem Description
Finally, YY graduated from a little known university and got employed by a small company, with great effort. The job is interesting, well paid and nice in many
aspects, except for the company is a little far from home. So YY has to take bus to work every day early in the morning, and prays for no traffic jams along the road.

The route of the bus is fixed. It goes past N+1 landmarks one by one, the first of which is the bus-stop where YY gets on the bus, and the last is the company
where he should get off. If traffic jams do not occur, the time consumed to go between landmarks is also fixed — Ti minutes from ith landmark to (i+1)th
landmark (1≤i≤N). However, if a traffic jam is encountered, things are different. After having been late for many times (and luckily enough not been fired by his
boss & girlfriend LMY), YY has discovered that the road between two consecutive landmarks will be jammed only in a fixed time period in a day. If the bus is
between ith landmark and (i+1)th landmark (excluding at the two landmarks themselves) and encounters a traffic jam, additional Di minutes are needed to
get to (i+1)th landmark.

Given the time YY gets on the bus and the time his company start to work, could he reach the company in time?

Input
For each test case, the first line contains only one integer N. (1≤N≤100)
Then N lines follow. The ith line of which describes the road between ith landmark and (i+1)th landmark. Two integers comes first, Ti and Di (1≤Ti , Di≤60), indicating
the basic time consumption and additional time consumption with traffic jam for the bus to go between the two landmarks, in minutes. A pair of time Si and Ei follows,
in HH:MM format (24 hours), indicating the starting and ending time of traffic jam between the two landmarks. Si is always strictly earlier than Ei, and they are always
in the same day.

The last line contains the time when YY gets on the bus and the time when the company starts to work, in HH:MM format (24 hours). He must arrive at the company
strictly before it starts to work, or he is late.

All times are in the same day.
Input end with N=0.

Output
For each test case, output one line with string “Poor YY!” if he will definitely be late or output “Lucky YY!” if he will not. Quotes for clarity, do not output them.

Sample Input
1
10 20 07:30 08:00
07:20 07:35
1
10 20 07:30 08:00
07:21 07:51
1
1 1 12:00 12:30
23:59 00:01
0

Sample Output
Lucky YY!
Poor YY!
Poor YY!

  • 写回答

1条回答 默认 最新

  • threenewbee 2017-12-10 16:17
    关注
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 基于卷积神经网络的声纹识别
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 stm32开发clion时遇到的编译问题