zoukankan      html  css  js  c++  java
  • 【CF1043A】Elections(签到)

    题意:给定n个数字,第i个为a[i],求使得sigma k-a[i]>sigma a[i]最小的k

    n,a[i]<=1e2

    思路:

     1 #include<cstdio>
     2 #include<cstring>
     3 #include<string>
     4 #include<cmath>
     5 #include<iostream>
     6 #include<algorithm>
     7 #include<map>
     8 #include<queue>
     9 #include<vector>
    10 #include<ctime>
    11 using namespace std;
    12 typedef long long ll;
    13 typedef unsigned int uint;
    14 typedef unsigned long long ull;
    15 typedef pair<int,int> PII;
    16 typedef vector<int> VI;
    17 #define fi first
    18 #define se second 
    19 #define MP make_pair
    20 #define N  210000
    21 #define M  130
    22 #define MOD 1000000007
    23 #define eps 1e-8 
    24 #define pi acos(-1)
    25 
    26 int main()
    27 {
    28     int n;
    29     scanf("%d",&n);
    30     int s=0;
    31     int mx=0;
    32     for(int i=1;i<=n;i++) 
    33     {
    34         int x;
    35         scanf("%d",&x);
    36         s+=x;
    37         mx=max(mx,x);
    38     }
    39     int ans=2*s/n;
    40     if(ans*n<=2*s) ans++;
    41     ans=max(ans,mx);
    42     printf("%d
    ",ans);
    43     return 0;
    44 }
  • 相关阅读:
    jquery ajax 分页2
    jquery('tr','div')和jquery('tr,div')
    ajax代码及简单封装
    jquery ajax 分页
    iframe加载的文档高度
    Bootstrap
    web 打印分页技巧
    web 后台打印
    存储过程自动更新ID
    Leetcode 105
  • 原文地址:https://www.cnblogs.com/myx12345/p/9872082.html
Copyright © 2011-2022 走看看