说明: USACO 1.1.2题解
描述
对于一群要互送礼物的朋友,你要确定每个人收到的礼物比送出的多多少(and vice versa for those who view gift giving with cynicism)(,反之亦然对于那些用贪婪的眼光来看礼物的人(by John))。
在这一个问题中,每个人都准备了一些钱来送礼物,而这些钱将会被平均分给那些将收到他的礼物的人。 然而,在任何一群朋友中,有些人将送出较多的礼物(可能是因为有较多的朋友),有些人有准备了较多的钱。
给出一群朋友, 没有人的名字会长于 14 字符,给出每个人将花在送礼上的钱,和将收到他的礼物的人的列表,请确定每个人收到的比送出的钱多的数目。
(Greedy Gift Givers
A group of NP (2 ≤ NP ≤ 10) uniquely named friends has decided to exchange gifts of money. Each of these friends might or might not give some money to any or all of the other friends. Likewise, each friend might or might not receive money from any or all of the other friends. Your goal in this problem is to deduce how much more money each person gives than they receive.
The rules for gift-giving are potentially different than you might expect. Each person sets aside a certain amount of money to give and divides this money evenly among all those to whom he or she is giving a gift. No fractional money is available, so dividing 3 among 2 friends would be 1 each for the friends with 1 left over-- that 1 left over stays in the giver s "account".
In any group of friends, some people are more giving than others (or at least may have more acquaintances) and some people have more money than others.
Given a group of friends, no one of whom has a name longer than )
文件列表:
gift1
.....\gift1.bak
.....\gift1.exe
.....\gift1.in
.....\gift1.o
.....\gift1.out
.....\gift1.pas
.....\gift1b.lpi
.....\gift1b.pas