#P16807. [蓝桥杯 2026 国 Python A] 桌游足球

    ID: 19148 远端评测题 3000ms 512MiB 尝试: 0 已通过: 0 显示难度普及+/提高− 上传者: 标签>组合数学2026蓝桥杯国赛

[蓝桥杯 2026 国 Python A] 桌游足球

Problem Description

Xiao Lan and Xiao Qiao played a tabletop soccer match. In the whole match, a total of N+MN + M goals were scored, where Xiao Lan scored NN goals and Xiao Qiao scored MM 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 44 goals are scored, and Xiao Lan scores 22 goals (N=2N = 2) while Xiao Qiao scores 22 goals (M=2M = 2), then among all possible scoring orders, only 22 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 11 goal while Xiao Qiao has scored 22 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 998244353998244353.

Input Format

The input consists of one line containing two positive integers NN and MM, 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 998244353998244353.

2 2
2

Hint

[Test Case Scale and Assumptions]

For 30%30\% of the testdata, 1≤M≤N≤101 \le M \le N \le 10.

For all testdata, 1≤M≤N≤1051 \le M \le N \le 10^5.

Translated by ChatGPT 5