|
"There is nothing new under the sun but there are lots of old things we don't know." |
You have been hired as a systems administrator for a large company. The company head office has n computers connected by a network of m cables. Each cable connects two different computers, and there is at most one cable connecting any given pair of computers. Each cable has a latency, measured in micro-seconds, that determines how long it takes for a message to travel along that cable. The network protocol is set up in a smart way, so that when sending a message from computer A to computer B, the message will travel along the path that has the smallest total latency, so that it arrives at B as soon as possible. The cables are bi-directional and have the same latency in both directions.
As your first order of business, you need to determine which computers
are connected to each other, and what the latency is along each of the
m cables. You soon discover that this is a difficult task because
the building has many floors, and the cables are hidden inside walls. So
here is what you decide to do. You will send a message from every computer
A to every other computer B and measure the latency. This will give you
Input
The first line of input gives the number of cases, N (at most 20).
N test cases follow. Each one starts with a line containing
n (0<n<100). The next
Output
For each test case, output a line containing "Case #x:". The next
line should contain m - the number of cables. The next m lines
should contain 3 integers each: u, v and w, meaning
that there is a cable between computers u and v, and it has
latency w. Lines should be sorted first by u, then by v,
with
| Sample Input | Sample Output |
2 3 100 200 100 3 100 300 100 |
Case #1: 2 1 2 100 2 3 100 Case #2: Need better measurements. |