编程介的小学生 2017-06-22 07:37 采纳率: 20.5%
浏览 801
已采纳

Hdu Girls' Day

Problem Description
Hdu Girls' Day is a traditional activity in Hdu. Girls in Hdu participate in the activity and show their talent and skill. The girls who win in the activity will become the Hdu's vivid ambassadors(形象大使). There are many students in Hdu concern the activity. Now it's the finally competition to determine who will be the Hdu's vivid ambassadors. The students vote for the girl they prefer. The girl who has the most number of votes will be the first. You as a student representing Hdu Acm team has a chance to vote. Every girl who participates in the activity has an unique No. and name. Because you very like prime number, you will vote for the girl whose No. has the maximum number of unique prime factors.

For example if the girl's No. is 12, and another girl's No. is 210, then you will choose the girl with No. 210. Because 210 = 2 *3 * 5*7 , 12 = 2*2*3. 210 have 4 unique prime factors but 12 just have 2. If there are many results, you will choose the one whose name has minimum lexicographic order.

Input
The first line contain an integer T (1 <= T <= 100).Then T cases followed. Each case begins with an integer n (1 <= n <= 1000) which is the number of girls.And then followed n lines ,each line contain a string and an integer No.(1 <= No. <= 2^31 - 1). The string is the girl's name and No. is the girl's No.The string's length will not longer than 20.

Output
For each case,output the girl's name who you will vote.

Sample Input
2
3
Kate 56
Lily 45
Amanda 8
4
Sara 55
Ella 42
Cristina 210
Cozzi 2

Sample Output
Kate
Cristina

  • 写回答

1条回答 默认 最新

  • threenewbee 2017-07-20 13:37
    关注
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 #MATLAB仿真#车辆换道路径规划
  • ¥15 java 操作 elasticsearch 8.1 实现 索引的重建
  • ¥15 数据可视化Python
  • ¥15 要给毕业设计添加扫码登录的功能!!有偿
  • ¥15 kafka 分区副本增加会导致消息丢失或者不可用吗?
  • ¥15 微信公众号自制会员卡没有收款渠道啊
  • ¥100 Jenkins自动化部署—悬赏100元
  • ¥15 关于#python#的问题:求帮写python代码
  • ¥20 MATLAB画图图形出现上下震荡的线条
  • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘