#P16807. [蓝桥杯 2026 国 Python A] 桌游足球
[蓝桥杯 2026 国 Python A] 桌游足球
Problem Description
Xiao Lan and Xiao Qiao played a tabletop soccer match. In the whole match, a total of goals were scored, where Xiao Lan scored goals and Xiao Qiao scored goals.
As a loyal tabletop soccer player, Xiao Lan set himself a “challenge” before the match: at any moment during the match, his cumulative number of goals must be ahead of, or tied with, Xiao Qiao. If at the moment of any goal Xiao Qiao takes the lead, then the challenge is considered failed.
For example, if a total of goals are scored, and Xiao Lan scores goals () while Xiao Qiao scores goals (), then among all possible scoring orders, only orders allow Xiao Lan to complete the challenge successfully: (Lan-Lan-Qiao-Qiao) and (Lan-Qiao-Lan-Qiao). For an order like (Lan-Qiao-Qiao-Lan), after the third goal, Xiao Lan has scored only goal while Xiao Qiao has scored goals, so Xiao Qiao takes the lead and the challenge fails early.
Unfortunately, the match was so intense that Xiao Lan forgot the exact scoring order after the match. He now wants to use math to derive: among all scoring orders that can reach the final score, how many different orders allow him to complete the challenge successfully?
Now, please write a program to help Xiao Lan compute the total number of scoring orders that satisfy the condition. Since the number of valid orders may be extremely large, output the result modulo .
Input Format
The input consists of one line containing two positive integers and , representing the final number of goals scored by Xiao Lan and Xiao Qiao, respectively.
Output Format
Output one line containing one integer, representing the number of scoring orders that satisfy the condition modulo .
2 2
2
Hint
[Test Case Scale and Assumptions]
For of the testdata, .
For all testdata, .
Translated by ChatGPT 5