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
35 7 7

Output
2

Input
321 10 2012

Output
1

Input
1 100

Output
0

链接

这个是队友想出来的 而且读题半天没猜出来是怎么回事(⊙﹏⊙)b

题意是说总共n瓶水 来回倒腾 直至水量相同 开始就一直纠结要是不能整除怎么办 出现分数就出现分数呗 只要最后水量相同就好了嘛

所以 找出水量大于平均数的瓶数 就是最终答案!

#include <iostream>
#include<cstdio>
#include<cstring>
using namespace std;
int n,k,m,y,a,t;
struct node
{int score;int trait;
}num[10004];
int main()
{freopen("cin.txt","r",stdin);while(~scanf("%d%d",&n,&k)){for(int i=1;i<=n;i++){scanf("%d%d",&num[i].score,&y);num[i].trait=0;while(y--){scanf("%d",&a);num[i].trait+=(1<<(a-1));//printf("i=%d num[i].trait=%d\n",i+1,num[i].trait);}}scanf("%d",&m);while(m--){scanf("%d%d",&a,&t);int tmp=0;while(t--){scanf("%d",&y);tmp+=(1<<(y-1));}printf("tmp=%d\n",tmp);tmp=tmp^num[a].trait;printf("tmp=%d\n",tmp);tmp=-(~tmp);printf("tmp=%d\n",tmp);int maxn=num[a].score,pos=a;for(int i=1;i<=n;i++){if(i==a) continue;int ans=0;ans=tmp^num[i].trait;if(ans==0) {maxn=max(maxn,num[i].score);pos=i;}}printf("%d\n",pos);}printf("\n");}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. 弱校联萌十一大决战之如日中天A Ariel【二进制+排序】

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

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

    [题目链接] (http://www.bnuoj.com/v3/contest_show.php?cid=6867#problem/C) 题目描述: C. Cinderella Time Limit: ...

  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. UC浏览器代理流量解密
  2. 医生们说,AI不会取代我们!
  3. MYsql 查询 查询当前月份的数据
  4. Linux虚拟机ip为127.0.0.1的处理
  5. Servlet3.0新特性WebFilter(Annotation Filter)详解
  6. 基于java的程序启动出错Could not create the Java virtual machine
  7. Struts2_3_国际化处理_自定义拦截器_文件上传及下载_OGNL
  8. 在全员编程时代下,软件测试员又该何去何从?
  9. 调研报告:原型图出稿
  10. 在线web工具pdf转word工具推荐【磁钉pdf转word】
  11. 阿里巴巴高级算法专家威视:组建技术团队的一些思考
  12. Android 桌面小组件 AppWidgetProvider
  13. 神秘的杀毒软件原理曝光
  14. 响应式垂直时间轴js特效插件 带动画效果
  15. 计算机硬件与软件教学反思,计算机硬件教学反思.doc
  16. 入手索尼WH-1000XM5头戴式降噪耳机,开启玩得尽兴、学得开心的新学期
  17. 简单的模拟京东商城购买过程-pymysql
  18. Mac使用Homebrew极速安装启动RabbitMQ一把梭
  19. sharding异常之no table route info
  20. 罗克韦尔自动化牵手FBS2017 推动中国食品饮料行业“智”变

热门文章

  1. 微信小程序服务商模式支付巨坑解决!
  2. 使用TamperMonkey实现慕课网自动播放下一集
  3. 公众号客服头像上传-java
  4. 菜鸟程序员的第一次写作经历
  5. 如何正确认识和推进企业数字化转型?
  6. 成功解决VMware Workstation cannot connect to the virtual machine. Make sure you have rights to run the p
  7. 仿六间房 新浪秀场网页视频聊天室 网页视频直播系统
  8. SKF VOGEL ZM505-3+140 ZP505
  9. 搭建一个简单的FAQ系统
  10. 上海亚商投顾:A股三大指数涨跌不一 ChatGPT、机器人概念齐掀涨停潮