题目
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
看不懂题啊……谁能帮把这道题大体的意思告诉我?感激不尽啊.
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
如果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的值和该切线方程.
我想写一篇关于奥巴马的演讲的文章,写哪一篇好呢?为什么好
奥巴马演讲不用看稿子.为什么中国领导演讲要看?
想找英语初三上学期的首字母填空练习……
英语翻译
最新试题
- 1He always()to the park on Sunday morningAgoBgoesCwentDis going
- 2若记号“*”表示以下运算:a*b=a+b/2,则(1*2)*(-3)= _ .
- 3急需10篇寒假英语周记,100字以上,
- 4翻成英文 要用括号的单词哦
- 5如果|a|=-a,那么a一定是 非正数,还是负数?
- 6酒店房间的英语单词
- 7如图是一种“羊头”形图案,其作法是:从正方形①开始,以它的一边为斜边,向外作等腰直角三角形,然后再以其直角边为边,分别向外作正方形②和②′,…,依此类推,若正方形①的
- 8由1,2,3三个数字可以组成没有重复的自然数( )
- 9He wants the latest book there is on the subject.语法分析
- 10What do you want to buy that for?改为同义句______________ you want to buy that?
热门考点
- 1两个两位有效数字的数加起来,其和也一定应保留两位有效数字,这句话对吗?
- 2一元一次不等式
- 3一个两位数,个位数比十位数字大,这个数是十位数的12倍.求这两个数
- 4水平面上三块完全相同的砖叠放在一起,现用水平力F推最上面的砖,没推动.分析三块砖的受力情况.
- 5(x*arctan(x))/(1+x^2)^2,求积分
- 6函数fx等于x的5次方加x的3次方加1(x属于r)若f(a)等于2,则f(负a)的值是
- 7《书愤》表达诗人怎样的情感
- 8水果的作文(产地 生长特点 形状 颜色 味道 作用)300字左右
- 9“不会因为任何事而改变”如何用英语翻译?
- 10This kind of food is very p____ in our city 填空