Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
考虑树的基本环路系统……然后大概是这样……In Reply To:弱问一下这题怎么做...看了解题报告一头雾水... Posted by:RoBa at 2007-10-06 21:19:48 给树的每条边标一个数,开始都是0。每一条额外的边把两个顶点x和y接起来,就把树上从x到y的路径上的边 的数都+1。这样搞完之后,算一下有多少条树边的数是0,把这个数目记成S。然后再枚举每一条额外的边, 数一下两个端点x和y之间在树里的路径中有多少条边的数是1,把这个数目累加到T。S*M+T.... 关键是折腾数据结构…… Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator