CF837F.Prefix Sums
提高+/省选-
通过率:0%
时间限制:1.00s
内存限制:256MB
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 y__i is equal to the sum of first i elements of array x (0 ≤ i ≤ m).
You have an infinite sequence of arrays _A_0, _A_1, _A_2..., where _A_0 is given in the input, and for each i ≥ 1 A__i = p(A__i - 1). Also you have a positive integer k. You have to find minimum possible i such that A__i contains a number which is larger or equal than k.
考虑函数 p(x),其中 x 是一个包含 m 个整数的数组,该函数返回一个包含 m+1 个整数的数组 y,使得对每个 0≤i≤m,yi 等于数组 x 的前 i 个元素之和。
你有一个无限数组序列 A0, A1, A2, …,其中 A0 由输入给出,且对每个 i≥1,有 Ai=p(Ai−1)。此外,你还有一个正整数 k。你需要找出最小的可能的 i,使得 Ai 中包含一个大于或等于 k 的数。
输入格式
The first line contains two integers n and k (2 ≤ n ≤ 200000, 1 ≤ k ≤ 1018). n is the size of array _A_0.
The second line contains n integers _A_00, _A_01... A_0_n - 1 — the elements of _A_0 (0 ≤ A_0_i ≤ 109). At least two elements of _A_0 are positive.
第一行包含两个整数 n 和 k(2≤n≤200000,1≤k≤1018)。n 是数组 A0 的大小。
第二行包含 n 个整数 A0,0, A0,1, …, A0,n−1 —— 即 A0 的元素(0≤A0,i≤109)。A0 中至少有两个元素为正数。
输出格式
Print the minimum i such that A__i contains a number which is larger or equal than k.
输出满足条件的最小下标 i,使得集合 Ai 中包含一个大于或等于 k 的数。
输入输出样例
输入#1
2 2 1 1
输出#1
1
输入#2
3 6 1 1 1
输出#2
2
输入#3
3 1 1 0 1
输出#3
0
输入解题思路,AI测评打分。不知道怎么写?