[题目链接] (http://www.bnuoj.com/v3/contest_show.php?cid=6867#problem/C)
题目描述:
C. Cinderella
Time Limit: Unknown msMemory Limit: 262144KB 64-bit integer IO format: %I64d Java class name: (Any)
Submit Status
Input/Output: standard input/output

Cinderella is given a task by her Stepmother before she is allowed to go to the Ball. There are N (1 ≤ N ≤ 1000) bottles with water in the kitchen. Each bottle contains Li (0 ≤ Li ≤ 106) ounces of water and the maximum capacity of each is 109 ounces. To complete the task Cinderella has to pour the water between the bottles to fill them at equal measure.

Cinderella asks Fairy godmother to help her. At each turn Cinderella points out one of the bottles. This is the source bottle. Then she selects any number of other bottles and for each bottle specifies the amount of water to be poured from the source bottle to it. Then Fairy godmother performs the transfusion instantly.

Please calculate how many turns Cinderella needs to complete the Stepmother’s task.

Input
The first line of input contains an integer number N (1 ≤ N ≤ 1000) — the total number of bottles.

On the next line integer numbers Li are contained (0 ≤ Li ≤ 106) — the initial amount of water contained in ith bottle.

Output
Output a single line with an integer S — the minimal number of turns Cinderella needs to complete her task.

Sample Input
Input
3
5 7 7
Output
2
Input
3
21 10 2012
Output
1
Input
1
100
Output
0
言简意赅:
Cinderella 要完成工作才能去参加ball,今晚,可怜的姑娘的工作是均匀分配瓶子中的水,N个瓶子中本来盛有不同量的水,请计算Cinderella要从多少个水多的瓶子(即源瓶)中往外倒水(即大于平均值的水瓶的个数),巨水的一道题,代码实现如下:

#include <iostream>
#include <cstdio>using namespace std;int a[1005];
int main()
{int n,count;long long sum;while(scanf("%d",&n)!=EOF){sum=0;count=0;for(int i=0;i<n;i++){scanf("%d",&a[i]);sum+=a[i];}sum=sum/n;for(int i=0;i<n;i++){if(a[i]>sum){count++;}}printf("%d\n",count);}return 0;
}

联萌十一大决战之如日中天 C. Cinderella(灰姑娘新编)相关推荐

  1. 弱校联萌十一大决战之如日中天-C. Cinderella

    Cinderella is given a task by her Stepmother before she is allowed to go to the Ball. There are N (1 ...

  2. 弱校联萌十一大决战之如日中天C Cinderella

    Input/Output: standard input/output Cinderella is given a task by her Stepmother before she is allow ...

  3. 弱校联萌十一大决战之如日中天A Ariel【二进制+排序】

    这个题也是太不好懂了==看了过的代码才明白(⊙﹏⊙)b 不过当时就能想到二进制也挺欣慰的 什么叫做"相同的必须有,没有的必须没有,其他的无所谓?"==>后来查询中的给的特征与 ...

  4. 2016弱校联萌十一专场10.2

    F.floyd-warshell 20000个点,距离为1的所有边求最短路 感觉就是单纯的生成树求最短路(最近公共祖先) 然后把去掉的边还原 把涉及的点bfs一下拼出最短路 赛场注意不要被这种题目吓到 ...

  5. [弱校联萌2016]2016弱校联盟十一专场10.2

    比赛链接:https://www.bnuoj.com/v3/contest_show.php?cid=8520 A.无非两种情况,点在体里和点在体外.在体外分三种情况,分别是到顶点的距离最小.到棱的距 ...

  6. [弱校联萌2016]2016弱校联盟十一专场10.3

    比赛链接:https://www.bnuoj.com/v3/contest_show.php?cid=8504#info A.找两个数乘积是连续上升并且最大的. 1 #include <bits ...

  7. [弱校联萌2016]2016弱校联盟十一专场10.5

    比赛链接:https://www.bnuoj.com/v3/contest_show.php?cid=8506#info I.裸数位dp,dp[l][pre][dir][fz]表示长度为l的时候上一个 ...

  8. 河南省多校联萌-HAUT-1285-军团再临

    问题 G: 军团再临 时间限制: 1 秒   内存限制: 128 MB 提交: 48   解决: 19 提交  状态 题目描述 燃烧军团大举入侵艾泽拉斯,现以在艾星建立了大量的军事要塞,这些要塞通过若 ...

  9. zzuli2181-GJJ的日常之暴富梦-多校联萌(四)

    传送门:https://acm.zzuli.edu.cn/zzuliacm/problem.php?id=2181 2181: GJJ的日常之暴富梦 Time Limit: 1 Sec   Memor ...

最新文章

  1. 日本漫画巨匠力作,看漫画就能学会Python,简直不要太轻松
  2. 浅谈TCP的窗口字段
  3. c#写的贪吃蛇小游戏
  4. go语言任意代码执行漏洞 cve-2018-6574
  5. update语句的返回值是什么
  6. 如何查看计算机配置和名称,如何查看电脑本机配置和跑分
  7. 软件项目管理的质量保证
  8. Github标星35K+超火的Spring Boot实战项目(附项目地址+教程文档)
  9. WPF仿微软事件和属性窗体,效果更炫!
  10. Oracle USE_LARGE_PAGES初始化参数
  11. won10qualcomm atheros无线网卡驱动安装不了
  12. html设计学校网站,基于HTML5的学校网站设计.doc
  13. 计算机组成原理(2021最新版)面试知识点集锦
  14. OSEK OS(OSEK 操作系统)
  15. QT如何实现二级下拉菜单(Combo box)
  16. java中stringBuilder的用法
  17. 电脑装windows和安卓双系统引导_Remix mini安卓电脑,玩的不只是Windows那张皮
  18. NLM去噪算法的python实现
  19. 前端框架MVC和MVVM的理解
  20. microtime() 函数

热门文章

  1. 本机IP地址,ios的IP地址,www.ip138.com,
  2. 使用NOWSMS搭建自己的彩信中心- -
  3. linux script 教程,linux下神奇的script命令,linuxscript命令
  4. 杰奇linux伪静态,nginx 杰奇 nginx 伪静态规则
  5. 杰奇php手机登陆自动跳转,杰奇cms通过js代码,实现微信访问自动登录
  6. poj1129Channel Allocation 图的染色问题
  7. 基金训练营学习笔记7-止盈
  8. 为期近五个月的英语培训班总结
  9. GPU百科全书(7)最后的流程总结
  10. OIM同步OID(OID-Connector 9.0.4.12)