Codeforces--1237A--Balanced Rating Changes

一场Codeforces比赛结束后,由于技术问题,比赛被设为半分制。原预计的评级变化之和为0,现在要将每个参赛者的评级变化除以2,并保持整数且尽可能接近原来的平方。你的任务是帮助实现这一平衡调整,使得调整后的评级变化总和依然为0。
摘要由CSDN通过智能技术生成

题目描述:
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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值