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: Let's Go to the Movies
Description A favorite pastime for big families in Acmestan is going to the movies. It is quite common to see a number of these multi-generation families going together to watch a movie. Movie theaters in Acmestan have two types of tickets: A It is quite challenging for families to decide which ticket arrangement is most economical to buy. For example, the family depicted in the figure on the right has four ticket arrangements to choose from: Seven single tickets; Two family tickets; One family ticket (for Write a program to determine which ticket arrangement has the least price. If there are more than one such arrangement, print the arrangement that has the least number of tickets. Input Your program will be tested on one or more test cases. The first line of each test case includes two positive integers (
where :-). Names are unique, the name of a particular person will appear at most twice: Once as a parent, and once as a child. There will be at least one person and at most 100,000 people in any test case.The end of a test case is identified by the beginning of the following test case (a line made of two integers.) The end of the last test case is identified by two zeros. Output For each test case, write the result using the following format:
Where Sample Input 1 3 adam bob cindy bob dima edie fairuz gary 1 2 john paul george ringo 1 3 a b c 0 0 Sample Output 1. 2 1 5 2. 4 0 4 3. 0 1 3 Source |

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

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

Any problem, Please Contact Administrator