lord of the ring(acm)看不懂题啊……谁能帮把这道题大体的意思告诉我?感激不尽啊.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

来源:学生作业帮助网 编辑:作业帮 时间:2024/04/28 14:11:48
lord of the ring(acm)看不懂题啊……谁能帮把这道题大体的意思告诉我?感激不尽啊.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

lord of the ring(acm)看不懂题啊……谁能帮把这道题大体的意思告诉我?感激不尽啊.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
lord of the ring(acm)
看不懂题啊……谁能帮把这道题大体的意思告诉我?感激不尽啊.
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 text file.Each data set in the file stands 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.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".
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 109.
In sample input 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.
Sample Input
6
1 2 2 3 3 5
3
1 2 2
Sample Output
4
No solution

lord of the ring(acm)看不懂题啊……谁能帮把这道题大体的意思告诉我?感激不尽啊.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
弗罗多必须完成一个神圣而又艰难的任务,他必须会没一个有魔力的邪恶的戒指.在这个探索中,他必须去一个叫莫多山的危险地方把魔戒扔进地缝的火焰中,他离开家已经一段时间了,现在正走着着一条到处充满荆棘的路.疲惫之极,弗罗多想自己最好休息一下.这条路上唯一安全的地方是一个灌木丛,它的位置是通过魔法公式用路上相邻两个灌木丛距离和P值计算出来的.不幸的是,弗罗多只知道相邻两个灌木丛之间的距离和魔法公式,但他不知道P值.你能在这方面帮助他吗?程序的输入来自文本文档,文档里的每一个数据代表弗罗多探险路上具体一组两个灌木丛之间的距离,每组数据以非减的顺序排列,空白区域可以自由输入.对每组数据,程序计算P值到标准输出,输出从一个单独划分的线开始.
如果P不能从所给的数据中计算出来,输出"No solution".
已知路上至少有两组之多有1000组灌木丛,还有P值不能超过109,
在样本输入里,输入第二组数据不能出结果,路上灌木丛的位置不能从数据中减少,因此两点之间的距离不能算出来.
样本输入
6
1 2 2 3 3 5
3
1 2 2
样本输入
4
No solution

输入告诉你一条直线上任意两个bush之间的距离,然后看有这些距离能否确定出一个bush的分布图,即确定每个bush都在什么位置上,然后从这个分布图算出P来
P就是所有相邻bush距离的乘积