Honkai Stress Relief

면접 대비

시간 제한1초메모리 제한2048 MB

요약
n개의 플레이 구간과 고정된 검사 구간 (a,b)가 주어질 때, 매일 (a,b)에서 균등하게 뽑은 시각이 플레이 구간 밖일 날이 하나 이상 있을 확률을 구한다.
난이도

보통10점 중 6점

유형
확률, 수학, 조합론
정답자
아직 제출이 없습니다

문제

Audrey, having finally finished her last exam, decided to lie in bed and open her favorite video game - Honkai: Star Rail.

Over each of the next nn days, Audrey has decided to carve out a block of time where she will play Honkai: Star Rail. This block of time may vary from day to day. Formally, if Audrey has carved out the interval (s,e)(s, e) to play Honkai: Star Rail, she is considered to be playing at all times tt where s<t<es < t < e.

Audrey's smartwatch tracks her stress level by doing a single check each day. If Audrey is playing Honkai: Star Rail at the instant in time when her smartwatch decides to perform a check, her smartwatch will report that she is relaxed. Otherwise, it will report that she is stressed. Audrey has configured her smartwatch to perform the check at some point within the time interval from (a,b)(a, b) each day. Formally, Audrey's smartwatch picks a value t_0t\_0 uniformly at random from all real values such that a<t_0<ba < t\_0 < b. If s<t_0<es < t\_0 < e, then the watch will report that Audrey is relaxed, otherwise it will report that Audrey is stressed. The value of t_0t\_0 is independent across different days, but the values of aa and bb are the same over all days.

Audrey does not want her smartwatch to report that she is stressed. Compute the probability that there is at least one day where Audrey's smartwatch reports that she is stressed.

입력

The first line of input contains three integers, nn, aa, and bb (1≤n≤201 \le n \le 20, 1≤a<b≤501 \le a < b \le 50).

Each of the next nn lines contains two integers, ss and ee (1≤s<e≤50)(1 \le s < e \le 50), indicating that Audrey will play Honkai: Star Rail from time ss to time ee exclusive on that day.

출력

Output a single number, the probability that there is at least one day where Audrey's smartwatch reports that she is stressed. Your answer will be accepted if the absolute or relative error is within 10−610^{-6} of the judge's answer.

예제1

  1. 예제 1

    입력
    2 19 39
    18 31
    28 50
    
    예상 출력
    0.67