第一层第二题:贪婪的礼物赠送者

该问题描述了一群朋友互相赠送金钱作为礼物的场景。每个人根据手中的金额平均分配给指定的接收者,剩余金额保留。程序需要计算每个人在送礼后比原先多或少的钱数。输入包含朋友数量、每个人的名字、每个人的初始金额及接收者列表,输出是每个人净收入的变化情况。
摘要由CSDN通过智能技术生成

Greedy Gift Givers

A group of NP (2 ≤ NP ≤ 10) uniquely named friends has decided to exchangegifts of money. Each of these friends might or might not give some money to anyor all of the other friends. Likewise, each friend might or might not receivemoney from any or all of the other friends. Your goal in this problem is todeduce 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 moneyevenly among all those to whom he or she is giving a gift. No fractional moneyis available, so dividing 3 among 2 friends would be 1 each for the friendswith 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 atleast may have more acquaintances) and some people have

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值