Kaylin loves mushrooms. Put them on her plate and she'll eat them up! In this problem she's eating a plate of mushrooms, and Bartholomew is putting more pieces on her plate.
In this problem, we'll look at how many pieces of mushroom are on her plate at
Figure out the minimum number of mushrooms that Kaylin could have eaten using two different methods of computation:
- Assume Kaylin could eat any number of mushroom pieces at any time.
- Assume that, starting with the first time we look at the plate, Kaylin eats mushrooms at a constant rate whenever there are mushrooms on her plate.
For example, if the input is 10 5 15 5
:
With the first method, Kaylin must have eaten at least
With the second method, Kaylin must have eaten at least
Input Specification
The first line of the input gives the number of test cases,
Output Specification
For each test case, output one line containing Case #x: y z
, where
Limits
Memory limit: 1 GB.
Small Dataset
Time limit: 30 seconds.
Large Dataset
Time limit: 60 seconds.
Sample Input
4
4
10 5 15 5
2
100 100
8
81 81 81 81 81 81 81 0
6
23 90 40 0 100 9
Sample Output
Case #1: 15 25
Case #2: 0 0
Case #3: 81 567
Case #4: 181 244
Note
This problem has different time limits for different batches. If you exceed the Time Limit for any batch, the judge will incorrectly display >60.000s
regardless of the actual time taken. Refer to the Limits section for batch-specific time limits.
This problem originally had a much higher time limit. However, as reference solutions were much faster, the Time Limit was been reduced accordingly.
Comments