在数字化转型中,企业如何通过小程序支付提升客户体验和运营效率?
531
2022-11-28
UVALive 7147 World Cup ——思维题
In normal football games, the winner team gets 3 points, loser team gets 0 point, and if there is a drawgame, both of the teams get 1 point.In World Cup 1994, Group D there is an interest thing happened. There are 4 teams in that group,Argentina, Nigeria, Bulgaria and Greece. Greece lost all the 3 matehes and scored 0. Argentina defeatedNigeria, Nigeria defeated Bulgaria and Bulgaria defeat Argentina. Since there are only 2 teams couldadvance to the next stage, one of the 3 teams will be eliminated. It’s really a surprise that a teamscored 6 will be eliminated in a 4 advance 2 group competition. That is really interesting and we’d liketo dig it deeper.In this problem, there are N teams in a group. Within a group, any two teams will play each otherexactly once, so each team will have N − 1 matches in total.In a match, the winner team will get A points and the loser team gets C points. If the match endswith a draw, each of the teams gets B points. When all matches finished, the teams will be ranked bytheir score (in case of multiple teams get the same score, they will be ordered randomly), and the topM teams from the group can advance to the next stage.Our questions are: What is the maximum possible score that a team can earn and still not advance?(Note that there may be other teams in the same group that also earn that same score and do advance.)Similarly, what is the minimum possible score that a team can earn and still advance?
题意:n支球队进行n(n-1)/2轮比赛,规定胜利的队得A分,失败的队得B分,平局各得C分,最终总分前m名可以进入总决赛,问
1、求最大的得分max,使得存在一只总分为max的队伍,该队伍没有晋级
2、求最小的得分min,使得存在一只总分为min的队伍,该队伍晋级
思路:
(若A比C小的话先交换A和C)
1.将n个队伍划分成m+1个队伍和n-m-1个队伍,设m+1个队伍的集合为X,n-m-1个队伍的集合为Y,则结果应该为集合X中最小的元素的值(排名为m+1的元素的值),为了让这个值尽量大,我们首先应该另X尽量大,即Y对X的贡献应该尽量大,这里直接给出结论:X中的所有元素都能战胜(或平局)Y中的所有元素时,Y对X的贡献最大,X中每一个元素接受Y中所有元素的贡献(n-m-1)*max(A,B),Y的作用就到此为止了。
现在X中每一个元素的基础值都为(n-m-1)*max(A,B),这是Y的贡献,下面来计算X集合内部比较产生的得分。我们要令X中最小的元素xm最大,这里再次直接给出结论:将X中的得分尽量平均分配时xm最大,这里的平均分配指的是xi与X的剩余元素比较时尽量输一把赢一把,输赢均等,所以对xm,我们在X剩余的m个元素中寻求一个均匀贡献,若m为偶数,那么结果是【m/2的赢(A)加m/2的输(C)】与【m次平局(B)】的最大值。若m是奇数,那么对于m-1和进行前面偶数情况的求解,对剩余的一个一定按照输(C)来处理,因为这个如果赢了xm就不是最小的了,最终把以上两部分相加就可以得到结果
2情况类似于1,请自行推理
#include
版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。
发表评论
暂时没有评论,来抢沙发吧~