eolymp
bolt
Try our new interface for solving problems
Problems

Necklace

Necklace

The people of a certain tribe produce circular ceramic discs with equal diameter by some rare clay. A necklace is formed by connecting one or more discs. The thickness of each disc is fixed. The figure below shows a necklace made with \textbf{4} discs. Its length is \textbf{4} times the diameter of each disc. \includegraphics{https://static.e-olymp.com/content/ef/efe767f34a987583441058268a89b2dd1e32b992.jpg} Let \textbf{V_total}_\{ \}is the total volume of clay you have. The diameter \textbf{D} and the volume of clay used \textbf{V} has the following relationship: \includegraphics{https://static.e-olymp.com/content/b0/b045f869bd6c1800b28f76134c98cff7d13dcaf2.jpg} \includegraphics{https://static.e-olymp.com/content/a9/a948ccdceea8008ac532a5d41323855a3683c74a.jpg} where \textbf{V_0} is the volume consumed in the baking process, in the same unit of \textbf{V}. When \textbf{V} ≤ \textbf{V_0}, no ceramic discs can be made. As an example, let \textbf{V_total} = \textbf{10}, \textbf{V_0} = \textbf{1}. If we use it to make \textbf{1} disc, \textbf{V} = \textbf{V_total} = \textbf{10}, \textbf{D} = \textbf{0.9}. If we divide the clay into \textbf{2} parts, the volume of each part \textbf{V} = \textbf{V_total} / \textbf{2} = \textbf{5}, and diameter of each disc formed is, thus the length of necklace formed this way is \textbf{0.6} * \textbf{2 = 1.2}. As per the above example, it is obvious that the lengths of necklaces differ as the number of discs made changes. Please write a program that computes the number of discs one should make so that the necklace formed is the longest. \InputFile Each line contains two numbers \textbf{V_total} (\textbf{0} < \textbf{V_total} ≤ \textbf{60000}) and \textbf{V_0} (\textbf{0} < \textbf{V_0} ≤ \textbf{600}), as defined above. Input ends with a case where \textbf{V_total} = \textbf{V_0} = \textbf{0} that is not processed. \OutputFile Each output line should give the number of discs one should make so that the necklace formed is the longest. If this number is not unique, or no necklaces can be formed at all, output \textbf{0} instead.
Time limit 1 second
Memory limit 128 MiB
Input example #1
10 1
10 2
0 0
Output example #1
5
0