ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1047. Simple Calculations

binary search
Posted by jagatsastry 20 Nov 2007 14:24
any hint as to how binary search technique can be used for this problem?
Re: binary search
Posted by KIRILL(ArcSTUpid coder:) 20 Nov 2007 15:06
Yua can do bs over a1, recalc sequence on each step
and check either last element of new sequence greater An+1 or less
Re: binary search
Posted by jagatsastry 1 Dec 2007 01:44
Do you mean to say i should choose a random number as a[1] and based on that value calculate a[n]. Then in the subsequent steps adjust the value of a[1] depending on how close the previous value of a[n] calculated was to the given value of a[n]. Is this the idea?
Re: binary search
Posted by KIRILL(ArcSTUpid coder:) 1 Dec 2007 04:07
jagatsastry wrote 1 December 2007 01:44
Do you mean to say i should choose a random number as a[1] and based on that value calculate a[n]. Then in the subsequent steps adjust the value of a[1] depending on how close the previous value of a[n] calculated was to the given value of a[n]. Is this the idea?

it's another approximation method

you can do bs of a[1] on range l:=-1000 to r:=1000
mid=(l+r)/2
a[1]=mid
then  calc new a'[n]
if a'[n] > a[n](wich is given) then r=mid else l=mid
that's all