Codeforces Round 320 (Div. 2) [Bayan Thanks-Round]
翻译中…
There is a polyline going through points $(0, 0) – (*x*, *x*) – (2*x*, 0) – (3*x*, *x*) – (4*x*, 0) – ... - (2*kx*, 0) – (2*kx* + *x*, *x*) – ...$.
翻译中…
We know that the polyline passes through the point $(*a*, *b*)$. Find minimum positive value $*x*$ such that it is true or determine that there is no such $*x*$.
翻译中…
Input
翻译中…
Only one line containing two positive integers $*a*$ and $*b*$ ($1 ≤ *a*, *b* ≤ 10^{9}$).
翻译中…
Output
翻译中…
Output the only line containing the answer. Your answer will be considered correct if its relative or absolute error doesn't exceed $10^{ - 9}$. If there is no such $*x*$ then output $- 1$ as the answer.
翻译中…
Note
翻译中…
You can see following graphs for sample 1 and sample 3.
翻译中…

翻译中…

翻译中…
样例
Input #1
3 1
Output #1
1.000000000000
InputCopy
OutputCopy
Input #2
1 3
Output #2
-1
InputCopy
OutputCopy
Input #3
4 1
Output #3
1.250000000000
InputCopy
OutputCopy
题目信息
题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。