#Lutece0576. Journey
Journey
Migrated from Lutece 576 Journey
All parts of this problem, including description, images, samples, data and checker, might be broken. If you find bugs in this problem, please contact the admins.
Description
In Tomb-sweeping Festival, Yangsir and her friends planned to have a journey in a park. The park has N attractions which form a circle and only between adjacent attractions there is a road, so there are roads in total. On the way to the park, Yangsir and her friends lost their way. After several twists and turns, they arrived at the park but they still didn't know which attraction they are on now.
Looking at the park's map, Yangsir wanted to know that: if they set attraction as starting point, what is the minimum time they needed to pass all N attractions at least once? They don't need to go back to the starting attraction and the time spend on attractions are ignored.
We number the attractions from to clockwise, and the road is the road between and attraction, except that the road is the road between and . The roads are all undirected.
Input
There are multiple test cases. The first line of the input will be an integer () indicating the number of test cases.
For each test case, the first line is only one integer (), representing the number of attractions in the park. In the second line there are positive integers separated by one space representing the time needed to pass through the road. All the integers above are within .
Output
For each test case, print Case #t:
first, in which is the number of the test case starting from . Then output integers separated by one space which are the minimum time needed if they start from attraction, attraction,..., attraction.
Samples
Resources
10th UESTC Programming Contest Final