编程介的小学生 2017-09-09 16:55 采纳率: 20.5%
浏览 848
已采纳

Hero

Problem Description
Every one own herself hero. The different hero must be famous in different field. So to compare them is a difficult things. Now given every hero a integer value to express the degree of famous. We call it Fv.
yifenfei want to know who is the most famous hero, so he ask many people to get the answer. Lots of people tell him as that: the Fv of hero A / the Fv of hero B equal to p / q.

Input
There are multiple cases in the input file.
Each case contains n (0< n <=27)
Next follow n line, each line as (hero A name # hero B name, p , q ).Length of name less 100 (the name will no ”#”). p, q is A positive integer less 10.

Output
Out put every hero relative value, the answer should be smallest(order by the lexicographically of hero name). Out put a line after every case. You may sure every case has answer.

Sample Input
1
Zhao yun # ji yuan 4 6

2
Ji yuan # Lemon 3 5
Lemon # Qi shi wang 2 9

Sample Output
Zhao yun 2
ji yuan 3

Ji yuan 6
Lemon 10
Qi shi wang 45

  • 写回答

1条回答

报告相同问题?

悬赏问题

  • ¥30 这是哪个作者做的宝宝起名网站
  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!