A. Elections
链接
[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的更多相关文章
- Codeforces Round #318 [RussianCodeCup Thanks-Round] (Div. 2) A. Bear and Elections 优先队列
A. Bear and Elections ...
- 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 ...
- 【CF850E】Random Elections(FWT)
[CF850E]Random Elections(FWT) 题面 洛谷 CF 题解 看懂题就是一眼题了... 显然三个人是等价的,所以只需要考虑一个人赢了另外两个人就好了. 那么在赢另外两个人的过程中 ...
- Codeforces 458C - Elections
458C - Elections 思路: 三分凹形函数极小值域 代码: #include<bits/stdc++.h> using namespace std; #define ll lo ...
- 【CF850E】Random Elections FWT
[CF850E]Random Elections 题意:有n位选民和3位预选者A,B,C,每个选民的投票方案可能是ABC,ACB,BAC...,即一个A,B,C的排列.现在进行三次比较,A-B,B-C ...
- CodeForces - 369C - Valera and Elections
369C - Valera and Elections 思路:dfs,对于搜索到的每个节点,看他后面有没有需要修的路,如果没有,那么这个节点就是答案. 代码: #include<bits/std ...
- CodeForces - 457C:Elections(三分)
You are running for a governor in a small city in Russia. You ran some polls and did some research, ...
- 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 ...
- 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 ...
- 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 ...
随机推荐
- 阿里八八Alpha阶段Scrum(1/12)
任务分配 叶文滔:整体框架UI设计.作为组长进行任务协调 俞鋆:后端服务器及数据库搭建 王国超:日程模块多日显示部分设计 黄梅玲:日程模块单日显示部分设计 林炜鸿:日程模块文本添加部分设计 张岳.刘晓 ...
- Docker介绍-hc课堂笔记
1,传统模式-多个服务器:申请.安装jdk等.部署环境. 容器-整包,把有东西打包到一起,把这个包放在服务器上. linux中装了docker,起100个服务,改个数字就可以,5分钟左右. 2,虚拟化 ...
- [转]OpenGL进阶(一) - 多视口
直接给出原文链接:OpenGL进阶(一) - 多视口
- WorldWind源码剖析系列:绘制参数类DrawArgs
绘制参数类DrawArgs主要对绘制时需要的对象如:设备对象Microsoft.DirectX.Direct3D.Device.Microsoft.DirectX.Direct3D.Font字体对象. ...
- NodeHandles
os::NodeHandle类有两个作用: 第一.它在roscpp程序内提供了一种RAII(Resource Acquisition Is Initialization)类型式启动和关闭内部节点的方法 ...
- Python2.7-浙江省实时天气爬取
先对中国天气网的实时天气数据进行了研究,数据在http://www.weather.com.cn/weather1d/101010100.shtml中,可以通过城市代码进行爬取,但实况数据是用JS动态 ...
- JavaScript标准对象
1.Date var now = new Date(); now; // Wed Jun 24 2015 19:49:22 GMT+0800 (CST) now.getFullYear(); // 2 ...
- Python:基础知识
python是一种解释型.面向对象的.带有动态语义的高级程序语言. 一.下载安装 官网下载地址:https://www.python.org/downloads 下载后执行安装文件,按照默认安装顺序安 ...
- STM32 & FreeRTOS & KFIFO (巧夺天工)
巧夺天工 的 KFIFO ,用STM32实现. 实现源文件如下: /********************************************************** * * 文件名 ...
- 20155301 Exp6 信息搜集与漏洞扫描
20155301 Exp6 信息搜集与漏洞扫描 实践内容 (1)各种搜索技巧的应用 (2)DNS IP注册信息的查询 (3)基本的扫描技术:主机发现.端口扫描.OS及服务版本探测.具体服务的查点 (4 ...