Naohiro has a monster. The monster's current health is H.
He also has N kinds of potions, numbered from 1 to N in ascending order of effectiveness.
If you give the monster potion n, its health will increase by Pn. Here, P1<P2<⋯<P N.
He wants to increase the monster's health to X or above by giving it one of the potions.
Print the number of the least effective potion that can achieve the purpose. (The constraints guarantee that such a potion exists.)
给定一个升序的数组 P,求满足 P_i+h\ge x 的 P_i 中最小的编号。
The input is given from Standard Input in the following format:
N H X
P1 P2 P3....PN
Print the number of the least effective potion that can achieve the purpose.
3 100 200 50 200 999
2
2 10 21 10 999
2
10 500 999 38 420 490 585 613 614 760 926 945 999
4
2≤N≤100
1≤H<X≤999
1≤P1<P2<⋯<PN=999
All input values are integers.
时间限制 | 1 秒 |
内存限制 | 128 MB |