#P10667. BZOJ2712 [Violet 2] 棒球
BZOJ2712 [Violet 2] 棒球
Problem 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 hit in at-bats, then their batting average is .
Uruto is an amateur baseball fan. Once, during training, he saw his own batting average statistic. He found that this value was rounded to 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 and a floating-point number . Here, is a decimal with 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.
2 0.33
3 0.316
3
19
Hint
For of the testdata, the answer is guaranteed to be within .
For all testdata, it is guaranteed that , and the number of test cases is within .
If a baseball player’s batting average is above , then they are definitely a key player on the team. With this in mind, it is guaranteed that for all testdata, .
Translated by ChatGPT 5