当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

3402:Ants run!

题目描述
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.
输入解释
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.
输出解释
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.
输入样例
2
3 1
1 1 1
2 1
1 2
输出样例
Inf
3.142
来自杭电HDUOJ的附加信息
Author lxhgww
Recommend lcy

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-3402

最后修改于 2020-10-25T23:03:13+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
6000/2000MS(Java/Others) 32768/32768K(Java/Others)