本篇文章主要介绍了"1003. Erdős Number"，主要涉及到1003. Erdős Number方面的内容，对于1003. Erdős Number感兴趣的同学可以参考一下。
Time Limit: 1sec Memory Limit:256MB
The Erdős number describes the "collaborative distance" between a person and mathematician Paul Erdős.
To be assigned an Erdős number, an author must co-write a research paper with an author with a finite Erdős number. Paul Erdős has an Erdős number of zero. Anybody else's Erdős number is k + 1 where k is
the lowest Erdős number of any coauthor. Erdős wrote around 1,500 mathematical articles in his lifetime, mostly co-written. He had 511 direct collaborators; these are the people with Erdős number 1. The people who have collaborated with them (but not with
Erdős himself) have an Erdős number of 2, those who have collaborated with people who have an Erdős number of 2 (but not with Erdős or anyone with an Erdős number of 1) have an Erdős number of 3, and so forth. (from wikipedia.org).
Assume that Paul Erdős is numbered 0, other actors are numbered by positive integers between 1 to 100.
The first line is the number of test cases. Each test case start with the number m of actors in a line, then m pairs of authors are followed.
For each test case, each author's Erdős number is printed out, if it is finite, in a separate line in the form "author number: Erdősnumber" in the order of increasing actor number, and finally
a dotted line "---" is printed out in a separate line.
Copy sample input to clipboard
直接上代码吧// Problem#: 8592
// Submission#: 2196678
// The source code is licensed under Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License
// URI: http://creativecommons.org/licenses/by-nc-sa/3.0/
// All Copyright reserved by Informatic Lab of Sun Yat-sen University
using namespace std;
for (int i = 1; i < 105; ++i)
/* code */