当前位置: > lord of the ring(acm)...
题目
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

提问时间:2021-09-10

答案
弗罗多必须完成一个神圣而又艰难的任务,他必须会没一个有魔力的邪恶的戒指.在这个探索中,他必须去一个叫莫多山的危险地方把魔戒扔进地缝的火焰中,他离开家已经一段时间了,现在正走着着一条到处充满荆棘的路.疲惫之极,弗罗多想自己最好休息一下.这条路上唯一安全的地方是一个灌木丛,它的位置是通过魔法公式用路上相邻两个灌木丛距离和P值计算出来的.不幸的是,弗罗多只知道相邻两个灌木丛之间的距离和魔法公式,但他不知道P值.你能在这方面帮助他吗?程序的输入来自文本文档,文档里的每一个数据代表弗罗多探险路上具体一组两个灌木丛之间的距离,每组数据以非减的顺序排列,空白区域可以自由输入.对每组数据,程序计算P值到标准输出,输出从一个单独划分的线开始.
如果P不能从所给的数据中计算出来,输出"No solution".
已知路上至少有两组之多有1000组灌木丛,还有P值不能超过109,
在样本输入里,输入第二组数据不能出结果,路上灌木丛的位置不能从数据中减少,因此两点之间的距离不能算出来.
样本输入
6
1 2 2 3 3 5
3
1 2 2
样本输入
4
No solution
举一反三
已知函数f(x)=x,g(x)=alnx,a∈R.若曲线y=f(x)与曲线y=g(x)相交,且在交点处有相同的切线,求a的值和该切线方程.
我想写一篇关于奥巴马的演讲的文章,写哪一篇好呢?为什么好
奥巴马演讲不用看稿子.为什么中国领导演讲要看?
想找英语初三上学期的首字母填空练习……
英语翻译
版权所有 CopyRight © 2012-2019 超级试练试题库 All Rights Reserved.