No.1042 Brute Force University
Problem Statement
Takahashi is a student at Brute Force University (abbreviated: Chokudai).
Meanwhile, his rival Hikuhashi is a student at Speedup University (abbreviated: Sokudai). One day, the two decided to compete to see who could solve a problem faster.
The size of a problem is denoted by $N$. Since Takahashi is a student at Brute Force University, he starts computing by brute force and takes $N^2$ seconds to finish solving the problem. On the other hand, since Hikuhashi is a student at Speedup University, $P$ seconds after seeing the problem he notices that the algorithm called binary search can be used on it, and it then takes him a further $Q*N*log_2 N$ seconds from actually starting to solve the problem until he finishes.
Takahashi wants to beat Hikuhashi, so find the largest $N$ in the range where Takahashi does not finish solving the problem later than Hikuhashi. It is guaranteed that Takahashi can beat Hikuhashi when $N=1$.
(Note): $N$ does not have to be an integer. Also, an error of up to $10^{-5}$ is allowed in the output.
(Added 2020/5/3: Under the constraints, it can be proved that Takahashi does not lose to Hikuhashi when the problem size is at least 1 and at most the N to be found.)
Input
$P\ Q$
$2 \le P \le 10^9$
$1 \le Q \le 10^9$
$P,Q$ are integers.
Output
Find the maximum problem size for which Takahashi does not lose. An absolute or relative error of up to $10^{-5}$ is allowed in the output.
Sample
Sample 1
Input
8 1
Output
4.000000000
When $N=4$, Takahashi and Hikuhashi finish solving the problem at the same time.
Sample 2
Input
7654321 1234567
Output
30706182.561749045
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。
Suunn
asdf1