P10667 BZOJ2712 [Violet 2] Baseball

Description

One of the most basic and simple technical statistics in baseball is the “batting average”. A “hit” means that the batter hits the ball pitched by the pitcher into fair territory, and the batter can reach at least first base safely. Since a team can score only when a player returns to home plate, hits are the most important way to score runs. Therefore, batting average is also a very important statistic for a batter. As the name suggests, batting average is the ratio of the number of hits to the number of at-bats. If a batter gets $1$ hit in $5$ at-bats, then their batting average is $0.2$. Uruto is an amateur baseball fan. Once, during training, he saw his own batting average statistic. He found that this value was rounded to $n$ digits after the decimal point. Uruto wants to know: at least how many at-bats could have produced such a batting average.

Input Format

The input file contains multiple test cases. - Each test case occupies one line and contains an integer $n$ and a floating-point number $r$. Here, $r$ is a decimal with $n$ digits after the decimal point, representing an approximate value of Uruto’s batting average.

Output Format

For each test case, output one integer on a separate line, representing the minimum possible number of at-bats for Uruto.

Explanation/Hint

For $20\%$ of the testdata, the answer is guaranteed to be within $1000$. For all testdata, it is guaranteed that $0