当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

3562:Interesting Tour

题目描述
Wuhan University is one of the most beautiful universities in China, and there are many charming scenic spots in the campus. After observing for several years, iSea find an interesting phenomenon of those spots: many old spots were built organically and not according to some architecture plan, but, strangely, their growth exhibits a similar pattern: the cities started from three points of spots, with each pair being connected by a bidirectional street; then, gradually, new points of spots were added. Any new point of spot was connected by two new bidirectional streets to two different previous points of spots which were already directly connected by a street.

A tourist visiting our university would like to do a tour visiting as many points of spots as possible. The tour can start at any point of spot and must end at the same point of spot. The tour may visit each street at most once and each point of spot at most once except the first point of spot.

Searing in the library, iSea have known how the scenic spots grew. Now he want to find the largest number of different points of spots a single tour can visit.
输入解释
There are several test cases in the input.

The first line of each case contains three integers N (3 < N <= 1000), indicating the total number of spots.
The next N-3 lines each contain a pair of space-separated integers A, B, indicating that the corresponding point of interest was connected by streets to points A and B. And you can assume both A and B had already connected.

The input terminates by end of file marker.
输出解释
For each test case, output one integer, indicating the largest number of different points of spots a single tour can visit.
输入样例
4
1 2
5
1 2
1 2
输出样例
4
4
来自杭电HDUOJ的附加信息
Author iSea@WHU
Recommend zhouzeyong

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-3562

最后修改于 2020-10-25T23:04:47+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
2000/1000MS(Java/Others) 32768/32768K(Java/Others)