题目描述:
Another Codeforces Round has just finished! It has gathered n participants, and according to the results, the expected rating change of participant i is ai. These rating changes are perfectly balanced — their sum is equal to 0.
Unfortunately, due to minor technical glitches, the round is declared semi-rated. It means that all rating changes must be divided by two.
There are two conditions though:
For each participant i, their modified rating change bi must be integer, and as close to ai2 as possible. It means that either bi=⌊ai2⌋ or bi=⌈ai2⌉. In particular, if ai is even, bi=ai2. Here ⌊x⌋ denotes rounding down to the largest integer not greater than x, and ⌈x⌉ denotes rounding up to the smallest integer not smaller than x.
The modified rating changes must be perfectly balanced — their sum must be equal to 0.
Can you help with that?
输入描述:
The first line contains a single integer n (2≤n≤13845), denoting the number of participants.
Each of the next n lines contains a single integer ai (−336≤ai≤1164), denoting the rating change of the i-th participant.
The sum of all ai is equal to 0.
输出描述:
Output n integers bi, each denoting the modified rating change of the i-th participant in order of input.
For any i, it must be true that either bi=⌊ai2⌋ or bi=⌈ai2⌉. The sum of all bi must be equal to 0.
If the
Codeforces--1237A--Balanced Rating Changes
最新推荐文章于 2022-01-30 16:23:08 发布
一场Codeforces比赛结束后,由于技术问题,比赛被设为半分制。原预计的评级变化之和为0,现在要将每个参赛者的评级变化除以2,并保持整数且尽可能接近原来的平方。你的任务是帮助实现这一平衡调整,使得调整后的评级变化总和依然为0。
摘要由CSDN通过智能技术生成