The Dean of the Unseen University, not unknown to inhabitants of the Discworld or their acquaintances,
has decided to modernise his communication by installing a computer network consisting of
a number of bidirectionally connected hosts, numbered from 1 to h consecutively. Unfortunately,
due to the highly magical nature of the environment, random changes in the network structure
occur quite often.
Therefore, it is especially useful to know which hosts can be reached and which cannot. Luckily the
changes in the structure can be monitored without further aecting the network and the current
network state can therefore be known at any time.
It is agreed upon that any host which can be reached in 10 hops or less from the main host,
number 1, is called online. This means that there may be a number of hosts which are reachable
from host 1, but are not called online. The Dean wants to know how many such hosts there are.
The rst line of the input le contains a single number: the number of test cases to follow. Each
test case has the following format:
For every test case in the input le, the output should contain a single number, on a single line:
the number of hosts reachable from host number 1 which are not considered online.
2 4 4 1 2 2 3 3 4 4 1 4 1 3 1 3 2 3 3 4 12 5 10 11 3 6 9 8 1 4 4 7 8 11 3 5 6 7 10 6 5 5 9 8 2 5 6 2 12
0 1
Migrated from old NTUJ.
No. | Testdata Range | Score |
---|