CF837F.Prefix Sums
普及/提高-
通过率:0%
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Consider the function p(x) , where x is an array of m integers, which returns an array y consisting of m+1 integers such that yi is equal to the sum of first i elements of array x ( 0<=i<=m ).
You have an infinite sequence of arrays A0,A1,A2... , where A0 is given in the input, and for each i>=1 Ai=p(Ai−1) . Also you have a positive integer k . You have to find minimum possible i such that Ai contains a number which is larger or equal than k .
输入格式
The first line contains two integers n and k ( 2<=n<=200000 , 1<=k<=1018 ). n is the size of array A0 .
The second line contains n integers A00,A10... An−10 — the elements of A0 ( 0<=Ai0<=109 ). At least two elements of A0 are positive.
输出格式
Print the minimum i such that Ai contains a number which is larger or equal than k .
输入输出样例
输入#1
2 2 1 1
输出#1
1
输入#2
3 6 1 1 1
输出#2
2
输入#3
3 1 1 0 1
输出#3
0