#P2899. [USACO08JAN] Cell Phone Network G
[USACO08JAN] Cell Phone Network G
Description
Farmer John wants all his cows to use cell phones so that they can communicate. He needs to build several cell towers among pastures. A tower provides coverage to the pasture it is placed on and to any pasture adjacent to it. You are given adjacency pairs between pastures. What is the minimum number of towers required so that every pasture has coverage?
Input Format
Line 1: an integer .
Lines 2 through : each line contains two integers separated by a space, giving one adjacent pair of pastures and .
Output Format
A single integer, the minimum number of towers to install.
5
1 3
5 2
4 3
3 5
2
Hint
For all testdata, , , .
Translated by ChatGPT 5
京公网安备 11011102002149号