P1818 Movie Voting
Description
There is a voting system that rates movies, where each vote must be an integer from $1$ to $10$. We want to cast as few votes as possible so that a movie’s average score falls below a certain value.
Input Format
Multiple test cases. Each test case consists of a single line containing two real numbers with exactly one decimal place $X$, $Y$, and a positive integer $N$. Here, $X$ is the movie’s current average score rounded to one decimal place, $Y$ is XP’s desired average score rounded to one decimal place, and the movie has already received $N$ votes. It is guaranteed that $Y \le X$. Process until EOF.
Output Format
For each test case, output a positive integer $\mathit{ans}$, meaning that in the worst case, as long as XP casts $\mathit{ans}$ votes, it is guaranteed that the movie’s average score rounded to one decimal place will be less than or equal to $Y$.
Explanation/Hint
### Constraints and Agreements
- For $30\%$ of the testdata, $1 \le N \le 100$, $1 \le T \le 100$.
- For $100\%$ of the testdata, $1 \le T \le 10^4$, $X, Y \in [1, 10]$, $1 \le N \le 10^6$.
### Notes
Round to one decimal place using the round half up method. Real numbers may have precision errors.
Translated by ChatGPT 5