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 |

Language: Genealogy
Description Alien Peter wants to trace his family pedigrees. Working hard for several weeks, he has created a beta-version of his family tree. Unfortunately, some of his ancestors have too much parents in this tree (aliens have For example, if then Peter should add at least two ancestors to make it look well-formed: Input Let Peter’s ancestors, appeared in the beta-version of his family tree, have identifiers from 1 to The first line of input file contains numbers n and d (2 ≤ Output Write the minimal number of Peter’s ancestors, that should be added to this tree to make it look well-formed. Sample Input 6 2 5 5 0 5 0 5 Sample Output 2 Source Northeastern Europe 2006, Northern Subregion |

[Submit] [Go Back] [Status] [Discuss]

All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di

Any problem, Please Contact Administrator