CF167B.Wizards and Huge Prize
普及+/提高
通过率:0%
时间限制:2.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
One must train much to do well on wizardry contests. So, there are numerous wizardry schools and magic fees.
One of such magic schools consists of n tours. A winner of each tour gets a huge prize. The school is organised quite far away, so one will have to take all the prizes home in one go. And the bags that you've brought with you have space for no more than k huge prizes.
Besides the fact that you want to take all the prizes home, you also want to perform well. You will consider your performance good if you win at least l tours.
In fact, years of organizing contests proved to the organizers that transporting huge prizes is an issue for the participants. Alas, no one has ever invented a spell that would shrink the prizes... So, here's the solution: for some tours the winner gets a bag instead of a huge prize. Each bag is characterized by number a__i — the number of huge prizes that will fit into it.
You already know the subject of all tours, so you can estimate the probability p__i of winning the i-th tour. You cannot skip the tour under any circumstances.
Find the probability that you will perform well on the contest and will be able to take all won prizes home (that is, that you will be able to fit all the huge prizes that you won into the bags that you either won or brought from home).
要在巫师竞赛中取得优异成绩,必须进行大量训练。因此,存在众多巫师学校以及相应的魔法学费。
其中一所魔法学校共设有 n 场赛事。每场赛事的获胜者将获得一个巨型奖品。该学校地处偏远,因此你必须一次性将所有赢得的奖品带回家。而你随身携带的背包容量至多只能装下 k 个巨型奖品。
除了要将所有奖品带回家这一目标外,你还希望表现出色。若你至少赢得 l 场赛事,则认为你的表现足够好。
事实上,多年组织此类竞赛的经验表明:运输巨型奖品对参赛者而言是一大难题。可惜,至今尚无人发明出能缩小奖品尺寸的咒语……于是,主办方提出了如下解决方案:在某些赛事中,获胜者获得的不是巨型奖品,而是一个背包。每个背包以数值 ai 表征——即该背包可容纳的巨型奖品数量。
你已事先知晓所有赛事的主题,因此可以估算出你在第 i 场赛事中获胜的概率 pi。你无法以任何理由跳过任何一场赛事。
请计算你在本次竞赛中既表现良好(即至少赢得 l 场赛事),又能将所有赢得的巨型奖品全部带回家(即:所有赢得的巨型奖品总数,能够被你所拥有的背包——包括自带的和比赛中赢得的——完全容纳)的概率。
输入格式
The first line contains three integers n, l, k (1 ≤ n ≤ 200, 0 ≤ l, k ≤ 200) — the number of tours, the minimum number of tours to win, and the number of prizes that you can fit in the bags brought from home, correspondingly.
The second line contains n space-separated integers, p__i (0 ≤ p__i ≤ 100) — the probability to win the i-th tour, in percents.
The third line contains n space-separated integers, a__i (1 ≤ a__i ≤ 200) — the capacity of the bag that will be awarded to you for winning the i-th tour, or else -1, if the prize for the i-th tour is a huge prize and not a bag.
第一行包含三个整数 n、l、k(1≤n≤200,0≤l,k≤200)——分别表示比赛场次总数、至少需获胜的场次数,以及你从家中带来的袋子所能容纳的奖品数量。
第二行包含 n 个用空格分隔的整数 pi(0≤pi≤100)——表示赢得第 i 场比赛的概率(以百分比为单位)。
第三行包含 n 个用空格分隔的整数 ai(1≤ai≤200)——表示赢得第 i 场比赛后所获袋子的容量;若第 i 场比赛的奖品是一个“大奖”(而非袋子),则对应 ai=−1。
输出格式
Print a single real number — the answer to the problem. The answer will be accepted if the absolute or relative error does not exceed 10 - 6.
输出一个实数——该问题的答案。只要答案的绝对误差或相对误差不超过 10−6,即视为正确。
输入输出样例
输入#1
3 1 0 10 20 30 -1 -1 2
输出#1
0.300000000000
输入#2
1 1 1 100 123
输出#2
1.000000000000
说明/提示
In the first sample we need either win no tour or win the third one. If we win nothing we wouldn't perform well. So, we must to win the third tour. Other conditions will be satisfied in this case. Probability of wining the third tour is 0.3.
In the second sample we win the only tour with probability 1.0, and go back home with bag for it.
在第一个样例中,我们需要要么一场比赛都不赢,要么赢得第三场比赛。如果我们一场比赛都不赢,那么我们的表现就不会很好。因此,我们必须赢得第三场比赛。在这种情况下,其他条件也会得到满足。赢得第三场比赛的概率为 0.3。
在第二个样例中,我们以概率 1.0 赢得唯一的一场比赛,并带着装有奖品的袋子回家。
输入解题思路,AI测评打分。不知道怎么写?