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

建议使用的浏览器:

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

1457:Lord of the Ring

题目描述
Frodo must accomplish a noble and difficult mission, he must destroy a magic and wicked ring. In this quest, he must travel to a dangerous place called Modor and throw the ring into a crevice of fire. He has left home for some time and is currently following a straight and quite long road that has bushes from place to place. Being very tired Frodo thinks he would better have some rest. The only safe place along the road is a bush the position of which can be computed using a magic formula that uses the value P that is the product of the distances between pairs of adjacent bushes along the road. Unfortunately what Frodo knows are only the distances between every pair of bushes along the road and the magic formula, but he doesn't know the value of P. Can you help him in this respect?
输入解释
The program input is from a std input. Each data set in the input for a particular set of distances between pairs of bushes on the road Frodo is traveling along. Each data set starts with the number of distances followed by the distances in nondecreasing order. White spaces can occur freely in the input.
It is known that there are at least two bushes and at most 1000 bushes along the road. Moreover, the value of P cannot exceed 10^9.
输出解释
For each set of data the program computes the value of P to the standard output from the beginning of a separate line. If P cannot be computed from the data set the output is "No solution".
输入样例
6
1 2  2   3  3 5

3
1 2 2 
输出样例
4
No solution
提示
The second data does not accept a solution. The bush positions along the road cannot be deduced from the data and therefore the distances between adjacent points cannot be computed.

该题目是Virtual Judge题目,来自 北京大学POJ

源链接: POJ-1457

最后修改于 2020-10-29T06:04:42+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
1000 10000