MatKor Cup Preliminary Seat Assignment
Time limit1sMemory limit1024 MB
Given N participants and M seats, find the expected number of correct seat predictions as a reduced fraction.
- Level
Medium4 of 10
- Topics
- Math, Probability
- Solved
- No attempts yet
Problem
This MatKor Cup preliminary check-in had participants in total, and the venue has prepared seats. Jongwoo assigned each of the participants a different seat in advance. Dongwoo asked Jongwoo how the seats were assigned.
Jongwoo would not simply tell him. Instead, he asked Dongwoo to predict the seats of all participants. Dongwoo chose different seats out of the seats and predicted each participant's seat.
Find the expected number of participants whose predicted seat matches the seat Jongwoo assigned.
Jongwoo and Dongwoo assign or predict seats with equal probability over all possible cases.
Input
The first line contains and (), separated by a space.
Output
Print the expected value on the first line as a reduced fraction (; ; ), written in the form /. If the answer is an integer, treat the denominator as 1.
Under the given constraints, the expected value is guaranteed to be rational.