首页 > ACM题库 > HDU-杭电 > hdu 3380 Circle of Friends待解决[解题报告]C++
2014
03-16

hdu 3380 Circle of Friends待解决[解题报告]C++

Circle of Friends

问题描述 :

After measuring the strength of friendships between different Navi, Grace wants to find groups of Navi who form close-knit friendships. A group of friends has strength k if each Navi in the group has at least k friends within the group. Your goal is to help Grace find the strongest, largest circle of friends for individual Navi.

输入:

Connections between Navi are described beginning with the line “GRAPH BEGIN”. Additional lines lists individual Navi, followed (on the same line) by their friends. The line ”GRAPH END” ends the list of connection descriptions. The next lines describe individual Navi to be analyzed, each on a single line. Following these lines, a completely new instance of the problem can be given, starting from scratch.

Some Navi may be only be listed as friends of other Navi (i.e., not all Navi will have their connections listed on a separate line).

输出:

Connections between Navi are described beginning with the line “GRAPH BEGIN”. Additional lines lists individual Navi, followed (on the same line) by their friends. The line ”GRAPH END” ends the list of connection descriptions. The next lines describe individual Navi to be analyzed, each on a single line. Following these lines, a completely new instance of the problem can be given, starting from scratch.

Some Navi may be only be listed as friends of other Navi (i.e., not all Navi will have their connections listed on a separate line).

样例输入:

GRAPH BEGIN 
a b c 
b c d e 
c d e 
e d f 
GRAPH END
a
b
c
d
e
f

样例输出:

a 2 a b c d e
b 3 b c d e
c 3 b c d e
d 3 b c d e
e 3 b c d e
f 1 a b c d e f