@shoom, I stand corrected. It appears that it is possible to design an algorithm where the total maximum cost is less than 400 coins in the worst case scenario.
I think using srqt decomposition would be better, as you only need to burn the panel 2 times to find the right voltage, regardless of the cost.
This seems more likely what one would do in real life, instead of burning the panel many times for no reason as happens in binary search approach (with ratio)…
You can run the code online or test in locally for a better understanding.
This code actually tells that what would be the array size after 5 steps if you keep on dividing the array in ratio 1:k ( where k in the code is 3.5 ) and every-time discard the right half.
And I have explained in the editorial itself as to why would this ratio work. You should read that.
On How I derived 3.5 :
What I explained in ‘Why will that ratio work’ and the concept of shift from binary search to linear search was in my mind beforehand. So actually I ended upon writing that code generalised for 1:k, Applied some hit and trials ( With k=1,2,3…(Actually I dont remember my trials) and finally ended up with k=3.5 ).
*So I didn’t derive it, rather it was like maybe this ratio thing will work ; Wrote a ratio code and did hit and trials to what that ‘k’ can be instead of deriving it in some mathematical way. And I proceeded with k=3.5 when I saw that after 5 operations ; I was left with array size 82 ( From code ) and had 1000-(150+1)5=245 coins left ; enough to shift from binary to linear search with a scope of one more burn in the linear search)
Still if you have any doubts , or wanted to ask something ; feel free to ask brother ; no Problem at ALLLL …!!!
(Just be more specific about your doubt that what exactly you want to ask…)
But once again no problem at all. Hope this helps…