The formula for converting a Gahrenheit temperature G to the corresponding Delsius temperature D is D=(G-A)*B/C. An integer Gahrenheit temperature is converted to Delsius and rounded to the nearest integer (rounding up to break the tie); the resulting integer Delsius temperature is converted back to Gahrenheit and rounded to the nearest integer (rounding up to break the tie too). For how many Gahrenheit temperature T with A <= T <= N does the original temperature equal the final temperature?
Note: the given equation may not be G=(D-32)*5/9.
There are multiple test cases.
Each test case consists of a single line containing the four intergers-A, B, C and N, listed in this order.
Input is terminated by EOF (End of File).
1 <= A,B,C <= 10000. A <= N <= 1018
For each test case, output one line - the answer.
32 5 9 1000
539
Migrated from old NTUJ.
CodeCraft 2010
No. | Testdata Range | Score |
---|