#P3330. [ZJOI2011] 看电影
[ZJOI2011] 看电影
Description
During a rare holiday, Xiaobai’s (Xiaobai) class organizes a movie trip. However, because many people watch movies during holidays, it is hard to seat everyone in the same showing. Finally, they find a cinema in a remote alley, but its seating assignment is special, as follows:
The cinema has seats, labeled . After buying a ticket, each person is randomly assigned a seat. Specifically, an integer is chosen uniformly at random from , and let it be .
If seat is empty, this seat is assigned to the person. Otherwise, increase by one and repeat the previous step; if there is no seat numbered , then the person has to stand to watch the movie, i.e., a standing ticket.
There are people in Xiaobai’s class (including Xiaobai). As a math enthusiast, Xiaobai wants to know the probability that the whole class can get seats.
Input Format
Multiple test cases. The first line contains an integer denoting the number of test cases. Then each of the next lines contains two integers denoting the number of people and the number of seats in the cinema.
Output Format
For each test case, output two integers on one line, indicating that the answer is . You need to ensure .
3
1 1
2 1
2 2
1 1
0 1
3 4
Hint
For of the testdata, , .
Translated by ChatGPT 5
京公网安备 11011102002149号