Problem Description
Mr. Pote's shop sells beans now. He has N bags of beans in his warehouse, and he has numbered them with 1, 2, …, N according to their expired dates. The i-th bag contains Wi units of beans. For selling at retail makes only a little profit, Mr. Pote want to pack beans in small packets with certain size and sell them in packets. Here comes his packing way:
Suppose the size of the packet is P units. Firstly, Mr. Pote selects some bags (at least one) of beans with consecutive number in his warehouse. Then he takes out the beans from all selected bags, and puts them together on the desktop. To pack the beans, he take P units of beans from desktop and fill in a new packet each time, until the beans left are less than P units. Finally the beans left on the desktop are eaten by a lucky dog.
Mr. Pote doesn't want the dog eat too many beans, so he prefers to solutions that resulting no more than K units of beans eaten by the dog. Moreover, he also wants to pack as many packets as possible. Could you tell him how many packets he can pack at most without breaking his preference?

Input
On the first line of input, there is a single positive integer T <= 20 specifying the number of test cases to follow.
Each test case contains two lines.
There are three integers in the first line, N, P, K as described above. (0 < N, P < 1000001, 0 <= K < P)
Next follow a line with N integers W1, W2, ..., WN. The i-th integers describes the amount of beans in the bags numbered i. (0 <= Wi < 32768)
Numbers are separated by spaces.

Output
For each test case you should output a single line containing "Case X: Y" (quotes for clarity) where X is the number of the test case (starting at 1) and Y is the maximum number of packets that Mr. Pote can pack following his way.
In case there's no solution avoiding the dog eats more than K units of beans, Y should be equal to -1.

Sample Input
3
10 20 10
0 3 1 8 19 39 2 9 1 8
3 100 10
32 34 23
1 5 3
1

Sample Output
Case 1: 4
Case 2: -1
Case 3: 0

-

-

-

-

-
Fibonacci公式的递推的步骤的过程的实现，怎么利用C语言的程序的设计的思维来实现的呢？
-

-

-

-

-
c++问题求解答！！！！
-
c语言疑似递归与循环小数丢失问题
-

-

-

-
C语言线程控制的程序设计
-
Fibonacci数列大数处理
-

-

-

from urllib import request import os from user_agents import ua_list import time import random import re import requests from lxml import etree class MeiziSpider(): def init(self): self.url = ‘https:/...

Java入门学习路线目录索引（持续更新中）

SpringBoot学习笔记三、http接口请求
controller package com.example.demo.controller; import java.util.HashMap; import java.util.Map; import org.apache.catalina.servlet4preview.http.HttpServletRequest; import org.springframework.we...

Python——画一棵漂亮的樱花树（不同种樱花+玫瑰+圣诞树喔）

HTML CSS整理笔记

linux系列之常用运维命令整理笔录

Python 基础（一）：入门必备知识
Python 入门必备知识，你都掌握了吗？

Ngrok： 超简单的内网穿透，了解一下 ？
【1】什么是内网穿透？ 首先，我们生活中的网络从应用上可以分为内网和外网； 内网就是你自己的网络环境，就你自己能访问，比如你本地测试进行的localhost； 外网就不言而喻了，你看网页，视频等这些网址都是外网。 那么什么又是内网穿透呢？简单的说就是通过访问一个外网地址，然后穿透到你的内网地址。 【2】内网穿透有什么用？ 【情景1】 假设你写了一个代码功能，本地测试已经OK，此...

【题目】我们公司的数据量非常大，需要的不仅仅是提取数据，要了解SQL方案优化的。一般在写SQL时需要注意哪些问题，可以提高查询的效率？【解题思路】数据量大的情况下，不同的SQL语句，消耗的时间相差很大。按下面方法可以提高查询的效果。1. select子句中尽量避免使用*select子句中，*是选择全部数据的意思。比如语句：“select * from 成绩表”，意思是选择成绩表中所有列的数据。在我...

Python十大装B语法
Python 是一种代表简单思想的语言，其语法相对简单，很容易上手。不过，如果就此小视 Python 语法的精妙和深邃，那就大错特错了。本文精心筛选了最能展现 Python 语法之精妙的十个知识点，并附上详细的实例代码。如能在实战中融会贯通、灵活使用，必将使代码更为精炼、高效，同时也会极大提升代码B格，使之看上去更老练，读起来更优雅。

2019年11月全国程序员工资统计，区块链工程师比算法工资高。

python学习目录