#P1818. 电影投票

电影投票

Description

There is a voting system that rates movies, where each vote must be an integer from 11 to 1010. 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 XX, YY, and a positive integer NN. Here, XX is the movie’s current average score rounded to one decimal place, YY is XP’s desired average score rounded to one decimal place, and the movie has already received NN votes. It is guaranteed that YXY \le X. Process until EOF.

Output Format

For each test case, output a positive integer ans\mathit{ans}, meaning that in the worst case, as long as XP casts ans\mathit{ans} votes, it is guaranteed that the movie’s average score rounded to one decimal place will be less than or equal to YY.

9.5 2.0 12 
4.4 3.4 12478   
10 3.4 23577
86   
5094   
63033

Hint

Constraints and Agreements

  • For 30%30\% of the testdata, 1N1001 \le N \le 100, 1T1001 \le T \le 100.
  • For 100%100\% of the testdata, 1T1041 \le T \le 10^4, X,Y[1,10]X, Y \in [1, 10], 1N1061 \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