Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

其实只要简单的定义判断~~

Posted by conanhjj at 2009-01-08 22:04:20 on Problem 1308
只要满足以下定义就算树:
1.根节点入度为0,其他各点入度为1
2.边的数目=点的数目-1


只要满足这些条件,就肯定是树。已经包含判断环,森林等条件了,有兴趣的各位可以推推看。

只要在输入的时候记录下每个点的入度,边的数目,点的数目即可...

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator