CF991B.Getting an A

入门

通过率:0%

时间限制:1.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Translator's note: in Russia's most widespread grading system, there are four grades: 5, 4, 3, 2, the higher the better, roughly corresponding to A, B, C and F respectively in American grading system.

The term is coming to an end and students start thinking about their grades. Today, a professor told his students that the grades for his course would be given out automatically — he would calculate the simple average (arithmetic mean) of all grades given out for lab works this term and round to the nearest integer. The rounding would be done in favour of the student — 4.54.5 would be rounded up to 55 (as in example 3), but 4.44.4 would be rounded down to 44.

This does not bode well for Vasya who didn't think those lab works would influence anything, so he may receive a grade worse than 55 (maybe even the dreaded 22). However, the professor allowed him to redo some of his works of Vasya's choosing to increase his average grade. Vasya wants to redo as as few lab works as possible in order to get 55 for the course. Of course, Vasya will get 55 for the lab works he chooses to redo.

Help Vasya — calculate the minimum amount of lab works Vasya has to redo.

译者注:在俄罗斯最普遍的评分体系中,共有四个等级:5、4、3、2,分数越高表示成绩越好,大致分别对应于美国评分体系中的 A、B、C 和 F。

学期即将结束,学生们开始关注自己的成绩。今天,一位教授告诉学生,本课程的成绩将自动给出——他将计算本学期所有实验课成绩的简单平均值(算术平均数),并四舍五入到最近的整数。该四舍五入规则对学生成绩有利:4.54.5 将向上取整为 55(如示例 3 所示),而 4.44.4 则向下取整为 44。

这对瓦夏(Vasya)而言可不是个好消息,因为他此前并未意识到这些实验课成绩会影响最终成绩,因此他可能得到低于 55 的成绩(甚至可能是令人恐惧的 22)。不过,教授允许他重做若干次自己选定的实验作业,以提高其平均分。瓦夏希望重做的实验作业次数尽可能少,从而确保最终课程成绩为 55。当然,对于他选择重做的实验作业,他都将获得 55 分。

请帮助瓦夏——计算他最少需要重做多少次实验作业。

输入格式

The first line contains a single integer nn — the number of Vasya's grades (1≤n≤1001 \leq n \leq 100).

The second line contains nn integers from 22 to 55 — Vasya's grades for his lab works.

第一行包含一个整数 nn —— 表示瓦夏的成绩数量(1≤n≤1001 \leq n \leq 100)。

第二行包含 nn 个整数,每个整数取值范围为 22 到 55 —— 表示瓦夏各次实验课的成绩。

输出格式

Output a single integer — the minimum amount of lab works that Vasya has to redo. It can be shown that Vasya can always redo enough lab works to get a 55.

输出一个整数——Vasya 需要重做的实验作业的最少数量。可以证明,Vasya 总是能够通过重做足够数量的实验作业来获得一个 55 分。

输入输出样例

  • 输入#1

    3
    4 4 4

    输出#1

    2
  • 输入#2

    4
    5 4 5 5

    输出#2

    0
  • 输入#3

    4
    5 3 3 5

    输出#3

    1

说明/提示

In the first sample, it is enough to redo two lab works to make two 44s into 55s.

In the second sample, Vasya's average is already 4.754.75 so he doesn't have to redo anything to get a 55.

In the second sample Vasya has to redo one lab work to get rid of one of the 33s, that will make the average exactly 4.54.5 so the final grade would be 55.

在第一个样例中,只需重做两次实验报告,即可将两个 44 分改为 55 分。

在第二个样例中,瓦夏的平均分已经是 4.754.75,因此他无需重做任何实验报告即可获得 55 分。

在第二个样例中,瓦夏需要重做一次实验报告,以消除其中一个 33 分,从而使平均分恰好达到 4.54.5,最终成绩即为 55 分。

输入解题思路,AI测评打分。不知道怎么写?

首页