Problem Description
Description
The New Year is coming soon, and wrz from Electronic Information is going to his relatives’ homes to collect New Year’s money.
He has three relatives. He has a Guge-brand electric scooter whose battery can only last from his own home to any one relative’s home; then the scooter runs out of power and is left at that relative’s home to charge.
wrz from Electronic Information walks to the remaining two relatives, then comes back and rides the fully charged Guge-brand scooter home.
But wrz from Electronic Information is lazy and does not like walking too much. Can you help him calculate the minimum distance he has to walk?
Input
The first line is the number T, indicating there are T (1<=T<=1000) test cases.
Each test case occupies one line and contains three integers x, y, and z, representing the distances between any two of the three relatives’ homes. (1<=x, y, z<=10~9)
For example, if the three relatives are a, b, and c, then the three numbers are the distance from a to b, from b to c, and from c to a.
Output
Each instance output occupies one line: the format is Case #x: y
x is the x-th instance, and y is the shortest distance wrz from Electronic Information needs to walk.
Sample Input
| |
Sample Output
| |
Problem Analysis
At first glance, the idea was to draw a triangle.
So it felt very simple.
But something still felt strange.
Then I suddenly realized
the catch is that these three values do not necessarily form a triangle.
When they do not form a triangle,
going back along the original route without visiting the third
uses less distance.
| |
Problem link: [ZZULI] [1799] wrz’s lucky money