問題一覧 > 通常問題

No.155 生放送とBGM

レベル : / 実行時間制限 : 1ケース 6.000秒 / メモリ制限 : 512 MB / 小数誤差許容問題 絶対誤差または相対誤差が $10^{-9}$ 以下。ただし、ジャッジ側の都合で500桁未満にしてください
タグ : (AC するまで非表示) / 解いたユーザー数 64
作問者 : LayCurse
お気に入りにしたユーザー ProblemId : 183 / 自分の提出
問題文最終更新日: 2026-06-25 00:50:06
Live Stream and BGM
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Show the original
yukicoder contest 87 (順位表) の他の問題:

Problem Statement

When Yuki streams live, she plays songs by a group called Clararis as background music.
Yuki's music player has $N$ songs by Clararis registered, and the length of the $k$-th song is $S_k$.
Yuki's live stream lasts $L$ minutes.
The music player has a shuffle feature: first, the registered songs are randomly reordered and then played in that order.
After all the songs have been played, they are randomly reordered again and played in that order.
Write a program that computes the expected number of songs that play for at least $1$ second during Yuki's stream.
For each random reordering, assume that all $N!$ possible orderings are equally likely, and that each reordering is done independently.
Yuki starts playback at the same moment the live stream begins.

Input

$N$ $L$
$S_1$ $S_2$ $\cdots$ $S_N$

$1 \leq N \leq 50$
$1 \leq L \leq 300$
$S_k$ is a string of the form $\verb|MM:SS|$, indicating that the length of the song is $\verb|MM|$ minutes and $\verb|SS|$ seconds ($00 \leq \verb|MM|,\verb|SS| \leq 59$, and $\verb|MM:SS| \neq 00\verb|:|00$)

Output

Output the expected number of songs played during the live stream on $1$ line.
Your answer is considered correct if the relative error is at most $10^{-9}$.
Print a newline at the end.

Sample

Sample 1
Input
5 30
10:30 20:47 08:14 29:59 05:24
Output
2.6

A typical live stream lasts $30$ minutes, right?
I thought about looking up the actual song data, but it was too much trouble, so I gave up.

Sample 2
Input
2 1
00:59 01:00
Output
1.5

If song $1$ plays first, song $2$ plays for $1$ second, so the number of songs played in this case is $2$.
If song $2$ plays first, song $1$ does not play, so the number of songs played in this case is $1$.
Therefore, the average number of songs played is $1.5$.

Sample 3
Input
4 300
00:01 00:02 00:01 00:03
Output
4

Even if the same song plays many times, $1$ song still counts as $1$ song.

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。