#P4370. [Code+#4] 组合数问题2
[Code+#4] 组合数问题2
Description
It is well known that Xiaocong is skilled at calculation, especially at computing binomial coefficients. Given two numbers and , he wants you to find distinct binomial coefficients such that their sum is maximized. By distinct binomial coefficients, for and , if or , we consider them different. Now, please find such distinct binomial coefficients so that for any one of them we have . What is the maximum possible sum of these binomial coefficients?
Input Format
Read from standard input.
The first line contains two integers .
Output Format
Write to standard output.
One line with a single integer, representing the sum of the binomial coefficients modulo ; it is guaranteed that there are at least numbers to choose from.
2 3
4
Hint
For 20% of the testdata, .
For 40% of the testdata, .
For another 20% of the testdata, .
For 100% of the testdata,
Credit: https://www.luogu.org/discuss/show/38908
Translated by ChatGPT 5
京公网安备 11011102002149号