CF498B.Name That Tune

提高+/省选-

通过率:0%

时间限制:1.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

It turns out that you are a great fan of rock band AC/PE. Peter learned that and started the following game: he plays the first song of the list of n songs of the group, and you have to find out the name of the song. After you tell the song name, Peter immediately plays the following song in order, and so on.

The i-th song of AC/PE has its recognizability p__i. This means that if the song has not yet been recognized by you, you listen to it for exactly one more second and with probability of p__i percent you recognize it and tell it's name. Otherwise you continue listening it. Note that you can only try to guess it only when it is integer number of seconds after the moment the song starts playing.

In all AC/PE songs the first words of chorus are the same as the title, so when you've heard the first t__i seconds of i-th song and its chorus starts, you immediately guess its name for sure.

For example, in the song Highway To Red the chorus sounds pretty late, but the song has high recognizability. In the song Back In Blue, on the other hand, the words from the title sound close to the beginning of the song, but it's hard to name it before hearing those words. You can name both of these songs during a few more first seconds.

Determine the expected number songs of you will recognize if the game lasts for exactly T seconds (i. e. you can make the last guess on the second T, after that the game stops).

If all songs are recognized faster than in T seconds, the game stops after the last song is recognized.

事实证明,你是一位著名摇滚乐队 AC/PE 的超级乐迷。彼得得知此事后,便启动了如下游戏:他依次播放该乐队歌单中的 nn 首歌曲(从第 1 首开始),而你需要说出当前播放歌曲的名称。一旦你报出歌名,彼得立即播放下一首歌曲,依此类推。

AC/PE 的第 ii 首歌曲具有辨识度 pip_i。这意味着:若你尚未辨认出该歌曲,则每多听 1 秒,你以 pip_i 百分比的概率成功辨认并报出歌名;否则你将继续收听。注意:你仅能在歌曲开始播放后的整数秒时刻(即第 1,2,3,…1,2,3,\dots 秒末)尝试猜测歌名。

在 AC/PE 的所有歌曲中,副歌的前几个词与歌名完全相同;因此,当你听到第 ii 首歌曲的前 tit_i 秒且副歌恰好在此时开始时,你将必然立刻准确报出其歌名。

例如,在歌曲 Highway To Red 中,副歌出现得较晚,但该曲辨识度很高;而在歌曲 Back In Blue 中,歌名所含词语在歌曲开头附近就已出现,但若未听到这些词则很难提前辨认。这两首歌你均可在最初几秒内完成辨认。

现给定游戏总时长恰好为 TT 秒(即你最后一次猜测必须发生在第 TT 秒末,此后游戏立即终止),请计算你期望能辨认出的歌曲数量。

若所有歌曲均在 TT 秒内被全部辨认完毕,则游戏在最后一首歌被辨认出后立即结束。

输入格式

The first line of the input contains numbers n and T (1 ≤ n ≤ 5000, 1 ≤ T ≤ 5000), separated by a space. Next n lines contain pairs of numbers p__i and t__i (0 ≤ p__i ≤ 100, 1 ≤ t__i ≤ T). The songs are given in the same order as in Petya's list.

输入的第一行包含两个整数 nn 和 TT(1 ≤ n ≤ 50001 ≤ n ≤ 5000,1 ≤ T ≤ 50001 ≤ T ≤ 5000),以空格分隔。接下来的 nn 行每行包含一对整数 pip_i 和 tit_i(0 ≤ pi ≤ 1000 ≤ p_i ≤ 100,1 ≤ ti ≤ T1 ≤ t_i ≤ T)。这些歌曲按 Petya 歌单中的相同顺序给出。

输出格式

Output a single number — the expected number of the number of songs you will recognize in T seconds. Your answer will be considered correct if its absolute or relative error does not exceed 10 - 6.

输出一个数字——你在 TT 秒内预期能识别出的歌曲数量。若你的答案的绝对或相对误差不超过 10−610^{-6},则视为正确。

输入输出样例

  • 输入#1

    2 2
    50 2
    10 1

    输出#1

    1.500000000
  • 输入#2

    2 2
    0 2
    100 2

    输出#2

    1.000000000
  • 输入#3

    3 3
    50 3
    50 2
    25 2

    输出#3

    1.687500000
  • 输入#4

    2 2
    0 2
    0 2

    输出#4

    1.000000000

输入解题思路,AI测评打分。不知道怎么写?

首页