编程介的小学生 2017-12-07 04:36 采纳率: 20.5%
浏览 810
已采纳

Ants run!

Problem Description
Professor Yang likes to play with ants when he is free.
This time, Professor Yang caught several ants after finishing his lecture for freshmen. At the beginning of the game, he puts N ants around a plate and numbers them in clockwise order. The ants are so obedient that they run clockwise under the guide of Professor Yang on the boundary of the plate which is a circle. At first the distances of every two adjacent ants are the same around the boundary of the circle. When one ant catches up with its previous ant, the game is over. Knowing the speed of ants, Professor Yang wants you to help him to change the order of the ants to make the game last longer.

Input
The first line of the input is T (no more than 100), which stands for the number of test cases you need to solve.
Each test case begins with N and R, representing the number of ants participating the game is N ( N <= 100000)and the radius of the circle is R(R <= 100000) cm. The next line lists N integers and the i-th number is the speed (cm/s) of the i-th ant in clockwise direction. All these N numbers are positive integer not larger than 1000.

Output
If the game can last forever, print “Inf” in a single line, otherwise please output the longest time in seconds each game can last, which should be printed accurately rounded to three decimals.

Sample Input
2
3 1
1 1 1
2 1
1 2

Sample Output
Inf
3.142

  • 写回答

1条回答 默认 最新

  • threenewbee 2018-02-14 15:43
    关注
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 聚类分析或者python进行数据分析
  • ¥15 如何用visual studio code实现html页面
  • ¥15 逻辑谓词和消解原理的运用
  • ¥15 三菱伺服电机按启动按钮有使能但不动作
  • ¥15 js,页面2返回页面1时定位进入的设备
  • ¥50 导入文件到网吧的电脑并且在重启之后不会被恢复
  • ¥15 (希望可以解决问题)ma和mb文件无法正常打开,打开后是空白,但是有正常内存占用,但可以在打开Maya应用程序后打开场景ma和mb格式。
  • ¥20 ML307A在使用AT命令连接EMQX平台的MQTT时被拒绝
  • ¥20 腾讯企业邮箱邮件可以恢复么
  • ¥15 有人知道怎么将自己的迁移策略布到edgecloudsim上使用吗?