#P5753. [NOI2000] 瓷片项链

[NOI2000] 瓷片项链

Description

A primitive tribe uses a rare kind of clay to fire circular porcelain discs of the same thickness and string them into a necklace. When stringing, the discs are connected in order along their diameters. There are no gaps and no overlaps between adjacent discs. A necklace consists of at least one disc.

The figure below shows a necklace made by stringing four discs of the same size. Its total length is four times the diameter of a single disc.

For each fired disc, the thickness is fixed, and the diameter DD and the volume of clay used VV satisfy:

$$D = \begin{cases} 0.3\sqrt{V-V_0} & V > V_0 \cr 0 & V \le V_0 \end{cases}$$

Here V0V_0 is the loss (waste) incurred when firing each disc, with the same unit as VV. If the amount of clay used is less than or equal to V0V_0, a disc cannot be produced.

Example: V=10V0=1V_总 = 10,V_0 = 1. If you fire one disc, V=V=10V = V_总 = 10, so D=0.9D = 0.9. If you divide the clay evenly into 22 parts, each part has volume V=V2=5V = \frac{V_总}{2} = 5, and the diameter of one disc is D=0.3×51=0.6D' = 0.3 \times \sqrt{5-1} = 0.6. Then the total length when strung is 1.21.2.

Given the total volume of clay and the loss for firing a single disc, different numbers of discs lead to different total necklace lengths. Compute how many discs should be fired to make the necklace as long as possible.

Input Format

Two lines in total, each line contains one integer.

The first line is the total volume of clay VV_总 (0<V<600000 < V_总 < 60000). The second line is the loss per disc V0V_0 (0<V0<6000 < V_0 < 600).

Output Format

One line containing one integer.

This integer is the number of discs to fire in order to obtain the longest necklace. If it is impossible to fire any disc, or if the optimal solution is not unique (there exist two or more choices that all achieve the maximum necklace length), output 0.

48
7

3

8
5

1

Hint

Translated by ChatGPT 5