链接

[http://codeforces.com/contest/1043/problem/A]

题意

有n个投票人已经投个对手ai票,让你求最小的k使得k-ai加起来大于,对手得票总和

分析

一个个往后枚举即可

代码

#include<bits/stdc++.h>
using namespace std;
#define ll long long int main(){
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int n,i;
int a[101];
while(cin>>n){
int k=0;
int sum=0;
for(i=0;i<n;i++){
cin>>a[i];
sum+=a[i];
k=max(k,a[i]);
}
while(true){
if(n*k-sum>sum) break;
else k++;
}
cout<<k<<endl;
}
return 0;
}

A. Elections的更多相关文章

  1. Codeforces Round #318 [RussianCodeCup Thanks-Round] (Div. 2) A. Bear and Elections 优先队列

                                                    A. Bear and Elections                               ...

  2. CF 369C . Valera and Elections tree dfs 好题

    C. Valera and Elections   The city Valera lives in is going to hold elections to the city Parliament ...

  3. 【CF850E】Random Elections(FWT)

    [CF850E]Random Elections(FWT) 题面 洛谷 CF 题解 看懂题就是一眼题了... 显然三个人是等价的,所以只需要考虑一个人赢了另外两个人就好了. 那么在赢另外两个人的过程中 ...

  4. Codeforces 458C - Elections

    458C - Elections 思路: 三分凹形函数极小值域 代码: #include<bits/stdc++.h> using namespace std; #define ll lo ...

  5. 【CF850E】Random Elections FWT

    [CF850E]Random Elections 题意:有n位选民和3位预选者A,B,C,每个选民的投票方案可能是ABC,ACB,BAC...,即一个A,B,C的排列.现在进行三次比较,A-B,B-C ...

  6. CodeForces - 369C - Valera and Elections

    369C - Valera and Elections 思路:dfs,对于搜索到的每个节点,看他后面有没有需要修的路,如果没有,那么这个节点就是答案. 代码: #include<bits/std ...

  7. CodeForces - 457C:Elections(三分)

    You are running for a governor in a small city in Russia. You ran some polls and did some research, ...

  8. Codeforces Round #157 (Div. 1) B. Little Elephant and Elections 数位dp+搜索

    题目链接: http://codeforces.com/problemset/problem/258/B B. Little Elephant and Elections time limit per ...

  9. codeforces Codeforces Round #318 div2 A. Bear and Elections 【优先队列】

    A. Bear and Elections time limit per test 1 second memory limit per test 256 megabytes input standar ...

  10. Codeforces Round #503 (by SIS, Div. 2) C. Elections(枚举,暴力)

    原文地址 C. Elections time limit per test 2 seconds memory limit per test 256 megabytes input standard i ...

随机推荐

  1. 2018.08.31 19:41 自学go语言

    有的人是从最基础的开始学,而我却是从最简单开始学,学着调试,学着编程,其实我也是编程小白,好多的不懂,我不明白很多都可以用云完成了,为什么还要继续自己编程,不明白,但是有需求吧,有需求是件好事情,说明 ...

  2. 不要以为字段以transient修饰的话就一定不会被序列化

    1: 先阅读这边文章:http://www.importnew.com/21517.html 2:被transient修饰真的会被序列化吗? 反例:java.util.ArrayList中底层存储数组 ...

  3. Kubernetes1.91(K8s)安装部署过程(二)--证书kubeconfig文件创建

    前提: 安装kubelet工具,参考:https://jimmysong.io/kubernetes-handbook/practice/kubectl-installation.html 如遇*** ...

  4. A - Zebras

    Oleg writes down the history of the days he lived. For each day he decides if it was good or bad. Ol ...

  5. 第3章 如何用DAP仿真器下载程序

    第3章     如何用DAP仿真器下载程序 全套200集视频教程和1000页PDF教程请到秉火论坛下载:www.firebbs.cn 野火视频教程优酷观看网址:http://i.youku.com/f ...

  6. Linux下MySQL安装与操作

    sudo apt-get update //用于更新源,获取软件包列表 sudo apt-get upgrade //用于升级指定软件包 install //安装 remove //移除软件包 aut ...

  7. ORACLE SEQUENCE 具体解释

    1.    About Sequences(关于序列) 序列是数据库对象一种. 多个用户能够通过序列生成连续的数字以此来实现主键字段的自己主动.唯一增长,而且一个序列可为多列.多表同一时候使用. 序列 ...

  8. 20155325 Exp7 网络欺诈防范

    实践内容(3.5分) 本实践的目标理解常用网络欺诈背后的原理,以提高防范意识,并提出具体防范方法.具体实践有 (1)简单应用SET工具建立冒名网站 (1分) (2)ettercap DNS spoof ...

  9. python 回溯法 子集树模板 系列 —— 12、选排问题

    问题 从n个元素中挑选m个元素进行排列,每个元素最多可重复r次.其中m∈[2,n],r∈[1,m]. 如:从4个元素中挑选3个元素进行排列,每个元素最多可重复r次. 分析 解x的长度是固定的,为m. ...

  10. kali黑客渗透测试基础环境准备

    1.apt-get install python-nmap 2.apt-get install python-setuptools 正在读取软件包列表... 完成 正在分析软件包的依赖关系树      ...