ANTHIL - Ant Hills
After many years of peace, an ant-war has broken out.
In the days leading up to the outbreak of war, the ant government devoted a great deal of resources toward gathering intelligence on ant hills. It discovered the following:
- The ant empire has a large network of ant-hills connected by bidirectional tracks.
- It is possible to send a message from any ant hill to any other ant hill.
Now you want to stop the war. Since they sometimes attack your house and disturb you quite a lot. So, you have made a plan. You have a gun which can destroy exactly one ant-hill. So, you want to hit an ant hill if it can stop at least two other ant hills passing messages between them. Now you want the total number of ant hills you may choose to destroy.
Input
Input starts with an integer T (≤ 20), denoting the number of test cases.
Each test case contains a blank line and two integers n (1 ≤ n ≤ 10000), m (1 ≤ m ≤ 20000). n denotes the number of ant hills and m denotes the number of bi-directional tracks. Each of the next m lines will contain two different integers a b (1 ≤ a, b ≤ n) denoting that there is a track between a and b.
Output
For each case, print the case number and the total number of ant hills you may choose to destroy. Output format: "Case x: answer" where x is the test case number
Example
Input: 2 5 4 2 1 1 3 5 4 4 1 3 3 1 2 2 3 1 3 Output Case 1: 2 Case 2: 0
Added by: | Aditya Dixit |
Date: | 2015-02-20 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: GOSU |