CF581C.Developing Skills
普及/提高-
通过率:0%
时间限制:1.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Petya loves computer games. Finally a game that he's been waiting for so long came out!
The main character of this game has n different skills, each of which is characterized by an integer a__i from 0 to 100. The higher the number a__i is, the higher is the i-th skill of the character. The total rating of the character is calculated as the sum of the values of
for all i from 1 to n. The expression ⌊ x⌋ denotes the result of rounding the number x down to the nearest integer.
At the beginning of the game Petya got k improvement units as a bonus that he can use to increase the skills of his character and his total rating. One improvement unit can increase any skill of Petya's character by exactly one. For example, if _a_4 = 46, after using one imporvement unit to this skill, it becomes equal to 47. A hero's skill cannot rise higher more than 100. Thus, it is permissible that some of the units will remain unused.
Your task is to determine the optimal way of using the improvement units so as to maximize the overall rating of the character. It is not necessary to use all the improvement units.
佩佳热爱电脑游戏。他期待已久的那款游戏终于上线了!
这款游戏的主角拥有 n 种不同的技能,每种技能由一个介于 0 到 100 之间的整数 ai 表示。数值 ai 越大,表示角色第 i 项技能越强。角色的总评分为所有 i(从 1 到 n)对应的值之和:
。其中符号 ⌊x⌋ 表示将实数 x 向下取整(即取不大于 x 的最大整数)。
游戏开始时,佩佳作为奖励获得了 k 个“提升单位”,可用于提升角色的各项技能及其总评分。每个提升单位恰好可使某一项技能值增加 1。例如,若 a4=46,则使用一个提升单位后该项技能变为 47。但角色的任意一项技能值均不得超过 100。因此,部分提升单位可能最终未被使用。
你的任务是确定提升单位的最优分配方式,使得角色的总评分最大化。不必用完全部 k 个提升单位。
输入格式
The first line of the input contains two positive integers n and k (1 ≤ n ≤ 105, 0 ≤ k ≤ 107) — the number of skills of the character and the number of units of improvements at Petya's disposal.
The second line of the input contains a sequence of n integers a__i (0 ≤ a__i ≤ 100), where a__i characterizes the level of the i-th skill of the character.
输入的第一行包含两个正整数 n 和 k(1 ≤ n ≤ 105,0 ≤ k ≤ 107)——分别表示角色的技能数量以及 Petya 可用的提升单位数。
输入的第二行包含一个由 n 个整数 ai(0 ≤ ai ≤ 100)组成的序列,其中 ai 表示角色第 i 项技能的等级。
输出格式
The first line of the output should contain a single non-negative integer — the maximum total rating of the character that Petya can get using k or less improvement units.
输出的第一行应包含一个非负整数——佩蒂亚使用不超过 k 个提升单位所能获得的角色总评分的最大值。
输入输出样例
输入#1
2 4 7 9
输出#1
2
输入#2
3 8 17 15 19
输出#2
5
输入#3
2 2 99 100
输出#3
20
说明/提示
In the first test case the optimal strategy is as follows. Petya has to improve the first skill to 10 by spending 3 improvement units, and the second skill to 10, by spending one improvement unit. Thus, Petya spends all his improvement units and the total rating of the character becomes equal to lfloor frac{100}{10} rfloor + lfloor frac{100}{10} rfloor = 10 + 10 = 20.
In the second test the optimal strategy for Petya is to improve the first skill to 20 (by spending 3 improvement units) and to improve the third skill to 20 (in this case by spending 1 improvement units). Thus, Petya is left with 4 improvement units and he will be able to increase the second skill to 19 (which does not change the overall rating, so Petya does not necessarily have to do it). Therefore, the highest possible total rating in this example is
.
In the third test case the optimal strategy for Petya is to increase the first skill to 100 by spending 1 improvement unit. Thereafter, both skills of the character will be equal to 100, so Petya will not be able to spend the remaining improvement unit. So the answer is equal to
.
在第一个测试用例中,最优策略如下:佩蒂亚需花费 3 个提升单位将第一项技能提升至 10,再花费 1 个提升单位将第二项技能提升至 10。因此,佩蒂亚耗尽了全部提升单位,角色的总评分为 ⌊10100⌋+⌊10100⌋=10+10=20。
在第二个测试用例中,佩蒂亚的最优策略是:花费 3 个提升单位将第一项技能提升至 20,并花费 1 个提升单位将第三项技能提升至 20。此时,佩蒂亚还剩余 4 个提升单位,可将第二项技能提升至 19(但这不会改变总评分,因此佩蒂亚不一定需要执行此操作)。因此,本例中可能达到的最高总评分为
。
在第三个测试用例中,佩蒂亚的最优策略是花费 1 个提升单位将第一项技能提升至 100。此后,角色的两项技能值均为 100,因此佩蒂亚无法再使用剩余的 1 个提升单位。故答案为
。
输入解题思路,AI测评打分。不知道怎么写?