AU7_5 - STUDENTS
Professor X wants to position N (1 <= N <= 100,000) girls and boys in a single row to present at the annual fair.
Professor has observed that the boys have been quite pugnacious lately; if two boys too close together in the line, they will argue and begin to fight, ruining the presentation. Ever resourceful, Professor calculated that any two boys must have at least K (0 <= K < N) girls between them in order to avoid a fight.
Professor would like you to help him by counting the number of possible sequences of N boys and girls that avoid any fighting. Professor considers all boys to be the same and all girls to be the same; thus, two sequences are only different if they have different kinds of students in some position.
First line contains C (1<=C<=20) the number of test cases
Next C lines contain N and K
A single integer representing the number of ways Professor could create such a sequence of students. Since this number can be quite large, output the result modulo 5000011.
learnt something new :)
Man Mohan Mishra:
awesome problem !!
My 500th completed classical problem :)