#P6191. [USACO09FEB] Bulls And Cows S
[USACO09FEB] Bulls And Cows S
Description
John is very resourceful. He has determined that there must be at least () cows between any two bulls in order to avoid fights. John wants you to help him calculate how many different arrangements can avoid any fighting. John considers all bulls identical and all cows identical. Therefore, as long as the positions of different types of cattle are different, the arrangements are considered different.
Input Format
Two integers and .
Output Format
Output the number of ways John can arrange them. Since this number may be very large, output the result modulo .
4 2
6
Hint
Below are the 6 feasible arrangements that FJ came up with ( stands for cow, stands for bull).
- CCCC
- BCCC
- CBCC
- CCBC
- CCCB
- BCCB
Translated by ChatGPT 5
京公网安备 11011102002149号