#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 KK (0K<N0 \leq K \lt N) 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 NN and KK.

Output Format

Output the number of ways John can arrange them. Since this number may be very large, output the result modulo 50000115\,000\,011.

4 2
6

Hint

Below are the 6 feasible arrangements that FJ came up with (CC stands for cow, BB stands for bull).

  • CCCC
  • BCCC
  • CBCC
  • CCBC
  • CCCB
  • BCCB

Translated by ChatGPT 5