# Practice on Toph

Participate in exhilarating programming contests, solve unique algorithm and data structure challenges and be a part of an awesome community.

Participate in exhilarating programming contests, solve unique algorithm and data structure challenges and be a part of an awesome community.

It is high time for the annual T5 racing and your team is planning to win the race.
In T5 racing the drivers need to complete at most ** X** laps (lap means a portion of a trip). However, the racing track is different from F5 racing. The T5 racing track has

For example, there are four checkpoints in the picture and three racing roads connecting them. The rules of the T5 racing are very simple. At any point of time, if a driver is at checkpoint **2**, he/she can move to any of the directly connected checkpoint **1** or **3** to complete one lap.
The race will start at checkpoint **1** and the drivers can finish the race at any checkpoint. Two drivers can take two different paths to finished the race as long as they complete at most ** X** laps.

A driver can add score point ** P_{i}** to his/her to her scorecard when he/she enters checkpoint

Since you are the greatest T5 hacker on this Galaxy, and you already know the racing track map for the next race. Now you have to tell what is the maximum score your team driver needs to win the race.

Input starts with an integer **T****(≤ 100)**, denoting the number of test cases.
Each case starts with two integers **N****(1 ≤** **N****≤ 100)** and **X****(1 ≤** **X****≤ 200)** as mentioned above. Next line contains * N* integers separated by space and the i’th integer of this line represents the score point

For each case, print the case number and the maximum score point your team driver needs to win the race in a line.

Input | Output |
---|---|

1 4 2 1 4 2 3 1 2 1 3 3 4 | Case 1: 6 |

75% Solution Ratio

balmarEarliest,

RobbinFastest, 0.0s

shahed95Lightest, 131 kB

sakib_muhitShortest, 1559B

Login to submit

Easy