CodeForces839B[思维] Codeforces Round #428 (Div. 2)
#include <bits/stdc++.h>
using namespace std;
int n, k;
const int MOD = ;
int a[], cnt[];
void solve() {
int t;
cnt[]=n,cnt[]=*n;
for(int i=;i<k;i++){
t=min(a[i]/,cnt[]);
a[i]-=*t;
cnt[]-=t;
}
cnt[]+=cnt[];
cnt[]+=cnt[];
for(int i=;i<k;i++){
t=min(a[i]/,cnt[]);
a[i]-=*t;
cnt[]-=t;
}
cnt[]+=cnt[];
for(int i=;i<k;i++){
t=min(a[i],cnt[]);
a[i]-=t;
cnt[]-=t;
}
for(int i=;i<k;i++)
if(a[i]){
puts("NO");
return;
}
puts("YES");
}
int main() {
cin >> n >> k;
for (int i = ; i < k; i++) {
cin >> a[i];
}
solve();
return ;
}
CodeForces839B[思维] Codeforces Round #428 (Div. 2)的更多相关文章
- CodeForces 839C - Journey | Codeforces Round #428 (Div. 2)
起初误以为到每个叶子的概率一样于是.... /* CodeForces 839C - Journey [ DFS,期望 ] | Codeforces Round #428 (Div. 2) */ #i ...
- CodeForces 839D - Winter is here | Codeforces Round #428 (Div. 2)
赛后听 Forever97 讲的思路,强的一匹- - /* CodeForces 839D - Winter is here [ 数论,容斥 ] | Codeforces Round #428 (Di ...
- CodeForces 839B - Game of the Rows | Codeforces Round #428 (Div. 2)
血崩- - /* CodeForces 839B - Game of the Rows [ 贪心,分类讨论] | Codeforces Round #428 (Div. 2) 注意 2 7 2 2 2 ...
- Codeforces Round #428 (Div. 2) 题解
题目链接:http://codeforces.com/contest/839 A. Arya and Bran 题意:每天给你一点糖果,如果大于8个,就只能给8个,剩下的可以存起来,小于8个就可以全部 ...
- Codeforces Round #428 (Div. 2) D. Winter is here 容斥
D. Winter is here 题目连接: http://codeforces.com/contest/839/problem/D Description Winter is here at th ...
- Codeforces Round #428 (Div. 2)E. Mother of Dragons
http://codeforces.com/contest/839/problem/E 最大团裸题= =,用Bron–Kerbosch算法,复杂度大多博客上没有,维基上查了查大约是O(3n/3) 最大 ...
- 【Codeforces Round #428 (Div. 2) B】Game of the Rows
[Link]:http://codeforces.com/contest/839/problem/B [Description] 给你n排的如题目所示的位置; 同一排中(1,2) 算相邻; (3,4) ...
- 【Codeforces Round #428 (Div. 2) C】Journey
[Link]:http://codeforces.com/contest/839/problem/C [Description] 给一棵树,每当你到一个点x的时候,你进入x的另外一每一个出度的概率都是 ...
- Codeforces Round #428 (Div. 2)A,B,C
A. Arya and Bran time limit per test 1 second memory limit per test 256 megabytes input standard inp ...
随机推荐
- IOS UIApplication使用
- (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typica ...
- java调用摄像头
http://blog.csdn.net/xing_sky/article/details/43482213 原文地址:http://blog.csdn.net/zajin/article/detai ...
- css与html结合四种方式
方式一:每个标签加一个属性法 <div style="background-color:red;color:green;"></div> 方式二:head中 ...
- SpringMVC URL模板模式映射
使用@RequestMaping和@PathVariable 组合使用 通过 @PathVariable 可以将 URL 中占位符参数绑定到控制器处理方法的入参中:URL 中的 {xxx} 占位符可 ...
- sendmail安装与配置
一.安装sendmail与mail 1.安装sendmail: 1) centos下可以安装命令:yum -y install sendmail 2) 安装完后启动sendmail命令:servic ...
- dynamic routing between captual
对于人脑 决策树形式 对于CNN 层级与层级间的传递 人在识别物体的时候会进行坐标框架的设置 CNN无法识别,只能通过大量训练 胶囊 :一个神经元集合,有一个活动的向量,来表示物体的各类信息,向量的长 ...
- Linux问题分析或解决_samba无法连接
1. windows设置方面问题 问题:window能连接部分服务器的samba共享,一部分无法连接.报错如截图. 解决:前提---其他人连接都没有问题,发现有问题的连接服务器的电脑是win10,而w ...
- JZOJ 4421. aplusb
4421. aplusb Time Limits: 1000 ms Memory Limits: 524288 KB Detailed Limits Goto ProblemSet Descr ...
- linux批量替换
sed -i "s/李三/李四/g" -r result/* 将result文件夹下的所有文件中的李三替换成李四 sed命令下批量替换文件内容 格式: sed -i ...
- A1095 Cars on Campus (30)(30 分)
A1095 Cars on Campus (30)(30 分) Zhejiang University has 6 campuses and a lot of gates. From each gat ...