阅读照亮教育:有人可以帮我翻译一下这个吗?我急需,谢谢!

来源:百度文库 编辑:查人人中国名人网 时间:2024/05/04 07:16:25
Blowing Fuses
Time Limit:1000MS Memory Limit:10000K
Total Submit:287 Accepted:141

Description
Maybe you are familiar with the following situation. You have plugged in a lot of electrical devices, such as toasters, refrigerators, microwave ovens, computers, stereos, etc, and have them all running. But at the moment when you turn on the TV, the fuse blows, since the power drawn from all the machines is greater than the capacity of the fuse. Of course this is a great safety feature, avoiding that houses burn down too often due to fires ignited by overheating wires. But it is also annoying to walk down to the basement (or some other inconvenient place) to replace to fuse or switch it back on.

What one would like to have is a program that checks before turning on an electrical device whether the combined power drawn by all running devices exceeds the fuses capacity (and it blows), or whether it is safe to turn it on.

Input
The input consists of several test cases. Each test case describes a set of electrical devices and gives a sequence of turn on/off operations for these devices.

The first line of each test case contains three integers n, m and c, where n is the number of devices (n <= 20), m the number of operations performed on these devices and c is the capacity of the fuse (in Amperes). The following n lines contain one positive integer ci each, the consumption (in Amperes) of the i-th device.

This is followed by m lines also containing one integer each, between 1 and n inclusive. They describe a sequence of turn on/turn off operations performed on the devices. For every number, the state of that particular devices is toggled, i.e. if it is currently running, it is turned off, and if it is currently turned off, it will by switched on. At the beginning all devices are turned off.

The input will be terminated by a test case starting with n = m = c = 0. This test case should not be processed.

Output
For each test case, first output the number of the test case. Then output whether the fuse was blown during the operation sequence. The fuse will be blown if the sum of the power consumptions ci of turned on devices at some point exceeds the capacity of the fuse c.

If the fuse is not blown, output the maximal power consumption by turned on devices that occurred during the sequence.

Output a blank line after each test case.

吹制融化
期限:1000MS 记忆界限:10000K
总数委托:287 接受:141

描述
也许你熟悉下列的情形。 你已经把许多电的装置, 像是烤箱、电冰箱、微波炉、计算机插电, 音响, 及其他, 而且有他们全部流动。 但是此刻,当你打开电视,熔断丝打击的时候,因为从所有的机器画的电源比熔断丝的能力棒。 当然,这是一个棒的安全特征, 避免