407542: GYM102823 K The Coin

Memory Limit:256 MB Time Limit:0 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

K. The Cointime limit per test5.0 smemory limit per test256 megabytesinputstandard inputoutputstandard output

"The Coin is invaluable."

If you believe that, just buy it and sell it out again!

The price of The Coin may fluctuate over time, but now you can predict the market prices in next $$$n$$$ days!

However, out of the magic power in The Coin, if you sell it out more than once, you have to notice that if the days between two successive selling are more than $$$L$$$, you will get a PUNISHMENT(WA) for your greed.

Now, can you imagine how many benefits you can gain without selling it out for more than $$$m$$$ times?

Do not forget that you are such a rich man that you do not need to worry about the price when you buy it.

Input

The first line of the input file contains a simple integer $$$T$$$ ($$$1\le T\le 20$$$) describing the number of test cases.

Then there are $$$2 \times T$$$ lines with every two lines representing a test case.

The first line of the test case contains three integers $$$n$$$, $$$L$$$, $$$m$$$ ($$$1 \leq L \leq n \leq 10^5$$$, $$$1 \leq m \leq 100$$$) described above.

The second line of that contain $$$n$$$ integers representing the prices of The Coin in following $$$n$$$ days, and each price is less than $$$10^9$$$, and greater than $$$0$$$.

You should notice that you do not have The Coin at first.

Output

Please print $$$T$$$ lines exactly.

For each case, print Case $$$d$$$: ($$$d$$$ represents the order of case) first, with the answer to corresponding test case followed.

ExampleInput
3
5 1 2
2 32 4 2 32
5 2 2
2 32 4 2 32
5 5 5
32 16 8 4 2
Output
Case 1: 30
Case 2: 32
Case 3: 0
Note
  • Sample 1: You can buy it in the first day, and sell it out in the fifth day.
  • Sample 2: You can buy it in the first day, and sell it out in third day. Then buy it in the fourth day, and sell it out in the fifth day.

    You should notice that you can not do the sellout in both the second day and fifth day because the days between those are beyond $$$L=2$$$ days.

  • Sample 3: You can do nothing with The Coin.

加入题单

上一题 下一题 算法标签: