|시간 제한||메모리 제한||제출||정답||맞은 사람||정답 비율|
|1 초 (추가 시간 없음)||512 MB||5||3||2||66.667%|
The thunderingly fun new game show of ’Jackpot’ has bounded onto televisio screens up and down the land and is the next big thing. It runs along a simple premise: there are a number of doors, behind one of which is hidden a monetary prize and behind all of the others of which are hidden goats. Each contestant chooses how many doors will be opened before they pick a door to look at. The prize decreases as each door is opened. If they manage to open the door and find the money they get to keep it!
Not content with guessing, you’ve decided to try and work out the best number of doors to open to maximise your expected profit, where expected profit is the probability of winning multiplied by the remaining prize fund.
You’ve managed to find out that the remaining prize fund PR is a function of the initial prize fund m, the number of doors opened d and a scaling factor f, ie.
PR = m − (d · f)2
Given the number of doors, initial prize fund and the scaling factor can you work out how many doors should be opened before you try to pick a door to maximise your expected profit?
One line of input containing:
There will always only be one door with the best value.
One line containing
The output must be accurate to an absolute or relative error of at most 10−6.
4 100 1
20000 100200300 0.8