#P3726. [AHOI2017/HNOI2017] 抛硬币
[AHOI2017/HNOI2017] 抛硬币
Description
A and B are good friends who often play together. Recently, B has been addicted to a mobile gacha game, grinding every day and not studying at all. After several months, he has never drawn an SSR, which makes him doubt life. The diligent A wants to persuade B to quit the game and study, so he decides to use coin tossing to show B that he is thoroughly unlucky. They would toss coins at the same time; if the number of heads A gets is greater than the number of heads B gets, then A wins.
However, A was also once addicted to a gacha game and has never drawn a UR, so he is not confident in his luck. He decides to cheat by secretly tossing a few extra times; to avoid suspicion, he will not toss too many extra times. Let be the total number of times A tosses, and be the total number of times B tosses. In how many possible outcomes can A defeat B? Since the answer can be large, you only need to output the last digits in decimal.
Input Format
Multiple test cases. For each test case, input three integers , representing the number of times A tosses, the number of times B tosses, and how many digits of the final answer to keep.
Output Format
For each test case, output one number: the last digits of the answer. If it has fewer than digits, pad with leading zeros.
2 1 9
3 2 1
000000004
6
Hint
For the first test case, when A tosses times and B tosses time, there are favorable outcomes in which A gets more heads than B. .
For the second test case, when A tosses times and B tosses times, there are favorable outcomes in which A gets more heads than B. $(001, 00), (010, 00), (100, 00), (011, 00), (101, 00), (110, 00), (111, 00), (011, 01)$ $(101, 01), (110, 01), (111, 01), (011, 10), (101, 10), (110, 10), (111, 10), (111, 11)$.
Constraints
of the testdata satisfies .
of the testdata satisfies .
of the testdata satisfies , among which satisfies .
of the testdata satisfies , , , and the number of test cases is at most .
Translated by ChatGPT 5
京公网安备 11011102002149号