atcoder#ARC085A. [ABC078C] HSI
[ABC078C] HSI
Score : points
Problem Statement
Takahashi is now competing in a programming contest, but he received TLE in a problem where the answer is YES
or NO
.
When he checked the detailed status of the submission, there were test cases in the problem, and the code received TLE in of those cases.
Then, he rewrote the code to correctly solve each of those cases with probability in milliseconds, and correctly solve each of the other cases without fail in milliseconds.
Now, he goes through the following process:
- Submit the code.
- Wait until the code finishes execution on all the cases.
- If the code fails to correctly solve some of the cases, submit it again.
- Repeat until the code correctly solve all the cases in one submission.
Let the expected value of the total execution time of the code be milliseconds. Print (as an integer).
Constraints
- All input values are integers.
Input
Input is given from Standard Input in the following format:
Output
Print , the expected value of the total execution time of the code, as an integer. It can be proved that, under the constraints in this problem, is an integer not exceeding .
1 1
3800
In this input, there is only one case. Takahashi will repeatedly submit the code that correctly solves this case with probability in milliseconds.
The code will succeed in one attempt with probability, in two attempts with probability, and in three attempts with probability, and so on.
Thus, the answer is $1900 \times 1/2 + (2 \times 1900) \times 1/4 + (3 \times 1900) \times 1/8 + ... = 3800$.
10 2
18400
The code will take milliseconds in each of the cases, and milliseconds in each of the cases. The probability of the code correctly solving all the cases is .
100 5
608000