CF369D.Valera and Fools
提高+/省选-
通过率:0%
时间限制:1.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
One fine morning, n fools lined up in a row. After that, they numbered each other with numbers from 1 to n, inclusive. Each fool got a unique number. The fools decided not to change their numbers before the end of the fun.
Every fool has exactly k bullets and a pistol. In addition, the fool number i has probability of p__i (in percent) that he kills the fool he shoots at.
The fools decided to have several rounds of the fun. Each round of the fun looks like this: each currently living fool shoots at another living fool with the smallest number (a fool is not stupid enough to shoot at himself). All shots of the round are perfomed at one time (simultaneously). If there is exactly one living fool, he does not shoot.
Let's define a situation as the set of numbers of all the living fools at the some time. We say that a situation is possible if for some integer number j (0 ≤ j ≤ k) there is a nonzero probability that after j rounds of the fun this situation will occur.
Valera knows numbers _p_1, _p_2, ..., p__n and k. Help Valera determine the number of distinct possible situations.
一个晴朗的早晨,n 个傻瓜排成一列。随后,他们依次给自己编号,编号范围为 1 到 n(含端点),每个傻瓜获得一个唯一的编号。傻瓜们决定在整场娱乐活动结束前不再更改自己的编号。
每个傻瓜恰好有 k 发子弹和一把手枪。此外,编号为 i 的傻瓜射击目标时,命中(即杀死)目标的概率为 pi(以百分比表示)。
傻瓜们决定进行若干轮娱乐活动。每轮娱乐活动的规则如下:所有当前仍存活的傻瓜同时(即在同一时刻)向编号最小的、仍存活的其他傻瓜开枪(傻瓜并不愚蠢到朝自己开枪)。如果仅剩一名傻瓜存活,则他不射击。
我们把某一时刻所有仍存活的傻瓜的编号所组成的集合定义为一种“局面”。若存在某个整数 j(满足 0≤j≤k),使得经过 j 轮娱乐活动后,该局面以非零概率出现,则称该局面是“可能的”。
瓦莱拉已知概率值 p1,p2,…,pn 和参数 k。请帮助瓦莱拉计算不同的可能局面的数量。
输入格式
The first line contains two integers n, k (1 ≤ n, k ≤ 3000) — the initial number of fools and the number of bullets for each fool.
The second line contains n integers _p_1, _p_2, ..., p__n (0 ≤ p__i ≤ 100) — the given probabilities (in percent).
第一行包含两个整数 n 和 k(1≤n,k≤3000)—— 分别表示初始的傻瓜数量以及每个傻瓜拥有的子弹数量。
第二行包含 n 个整数 p1,p2,…,pn(0≤pi≤100)—— 给定的概率(以百分比表示)。
输出格式
Print a single number — the answer to the problem.
输出一个数字——该问题的答案。
输入输出样例
输入#1
3 3 50 50 50
输出#1
7
输入#2
1 1 100
输出#2
1
输入#3
2 1 100 100
输出#3
2
输入#4
3 3 0 0 0
输出#4
1
说明/提示
In the first sample, any situation is possible, except for situation {1, 2}.
In the second sample there is exactly one fool, so he does not make shots.
In the third sample the possible situations are {1, 2} (after zero rounds) and the "empty" situation {} (after one round).
In the fourth sample, the only possible situation is {1, 2, 3}.
在第一个样例中,除情况 {1, 2} 外,其余所有情况均可能发生。
在第二个样例中,恰好有一名傻瓜,因此他不会进行射击。
在第三个样例中,可能的情况为 {1, 2}(经过零轮后)以及空情况 {}(经过一轮后)。
在第四个样例中,唯一可能的情况是 {1, 2, 3}。
输入解题思路,AI测评打分。不知道怎么写?