【CF1043A】Elections(签到)
2024-09-29 16:05:12
题意:给定n个数字,第i个为a[i],求使得sigma k-a[i]>sigma a[i]最小的k
n,a[i]<=1e2
思路:
#include<cstdio>
#include<cstring>
#include<string>
#include<cmath>
#include<iostream>
#include<algorithm>
#include<map>
#include<queue>
#include<vector>
#include<ctime>
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int,int> PII;
typedef vector<int> VI;
#define fi first
#define se second
#define MP make_pair
#define N 210000
#define M 130
#define MOD 1000000007
#define eps 1e-8
#define pi acos(-1) int main()
{
int n;
scanf("%d",&n);
int s=;
int mx=;
for(int i=;i<=n;i++)
{
int x;
scanf("%d",&x);
s+=x;
mx=max(mx,x);
}
int ans=*s/n;
if(ans*n<=*s) ans++;
ans=max(ans,mx);
printf("%d\n",ans);
return ;
}
最新文章
- JSON Web Token实际应用
- <;<;<; html图片背景平铺
- lstm
- Rshare Pro是否可以放入至客户企业App Store?
- javascript 打开新窗口(window.open)
- Parallelogram Counting(平行四边形个数,思维转化)
- jquery 工作笔记,不断整理中..
- Linux中处理需要传输的IP报文流程
- Http请求工具实例编写(超长,比较清楚)
- isinstance使用方法
- 服务器Nginx 反向代理 其他服务器 8181端口 失败的问题
- c# List列表数据转换成树形结构
- 搭建自己的hexo博客
- 取消win10 任务栏已固定的软件
- 阿里启动新项目:Nacos,比 Eureka 更强!
- Android开发 ---代码创建选项菜单、隐藏菜单项、菜单的生命周期,菜单按钮图标设置、搜索框、xml中设置子菜单
- pycharm如何新项目如何不默认创建虚拟环境(吐槽)
- yolov2源码分析
- vux icon
- 差异表达分析之FDR