• 博客园logo
  • 会员
  • 周边
  • 新闻
  • 博问
  • 闪存
  • 众包
  • 赞助商
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
HaibaraAi
博客园    首页    新随笔    联系   管理    订阅  订阅

Warm up 15 Cinderella

Cinderella
Time Limit: 10000ms, Special Time Limit:25000ms, Memory Limit:65536KB
Total submit users: 56, Accepted users: 50
Problem 12768 : No special judgement
Problem description
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 10^9 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
Sample Input 1
3
5 7 7

Sample Input 2
3
21 10 2012

Sample Input 3
1
100
Sample Output
Sample Output 1
2

Sample Output 2
1

Sample Output 3
0
Problem Source
HNU Contest 
Submit   Discuss   Judge Status  Problems  Ranklist 
 1 #pragma comment(linker, "/STACK:1024000000,1024000000")
 2 #include <map>
 3 #include <queue>
 4 #include <vector>
 5 #include <string>
 6 #include <cmath>
 7 #include <cstdio>
 8 #include <cstring>
 9 #include <cstdlib>
10 #include <iostream>
11 #include <algorithm>
12 using namespace std;
13 #define maxn 1305
14 #define ll long long
15 #define mod 1000000007
16 #define INF 0x7fffffff
17 #define eps 1e-8
18 int n,m;
19 int a[maxn];
20 int main(){
21     /*int t;
22     scanf("%d", &t);
23     while (t--){
24         scanf("%I64d", &n);
25         
26     }*/
27     while (~scanf("%d", &n)){
28         ll s = 0;
29         for (int i = 0; i < n; i++){ scanf("%d", &a[i]); s += a[i]; }
30         s = s / n;
31         int x = 0;
32         for(int i=0;i<n;i++)if (a[i]>s)x++;
33         printf("%d\n", x);
34     }
35     return 0;
36 }
View Code
posted @ 2013-11-02 18:45  HaibaraAi  阅读(120)  评论(0)    收藏  举报
刷新页面返回顶部
博客园  ©  2004-2026
浙公网安备 33010602011771号 浙ICP备2021040463号-3