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 ...
随机推荐
- 【BZOJ3209】花神的数论题(数位DP)
点此看题面 大致题意: 设\(sum(i)\)表示\(i\)二进制中1的个数,请求出\(\prod_{i=1}^n sum(i)\). 数位\(DP\) 很显然,这是一道数位\(DP\)题.我们可以先 ...
- 第五章 javascript编程可养成的好习惯
用户点击某个链接时弹出一个新窗口javascript使用window对象的open()方法来创建新的浏览器窗口,这个方法有三个参数:window.open(url,name,features)url: ...
- 小w的糖果
题目连接 : https://ac.nowcoder.com/acm/contest/923/C 算是一道找规律的题了,因为后一个人会比前一个人多,可以理解成后一个人要继承前一个人,sum为当前糖果数 ...
- CUDA编程时,线程块的处理方法
- UOJ#386. 【UNR #3】鸽子固定器(链表)
题意 题目链接 为了固定S**p*鸽鸽,whx和zzt来到鸽具商店选购鸽子固定器. 鸽具商店有 nn 个不同大小的固定器,现在可以选择至多 mm 个来固定S**p*鸽鸽.每个固定器有大小 sisi 和 ...
- 自封装的AJAX
/* * *create by royal in 2019/1/23 * *royalAjax 自封装ajax函数 * *paramsObj JSON类型参数 *require params: * t ...
- js中如何把RGB颜色转换为16进制颜色
将RGB颜色值转换为16进制颜色值,主要是将 R.G.B 值分别转换为对应的十六进制值,填入 #RRGGBB 中. 推荐在线颜色转换工具:http://www.ecjson.com/rgbhex/ 例 ...
- batch-normalization为什么效果好
batch-normalization为什么效果好 深度学习中 Batch Normalization为什么效果好? - 龙鹏-言有三的回答 - 知乎 https://www.zhihu.com/qu ...
- 678. Valid Parenthesis String
https://leetcode.com/problems/valid-parenthesis-string/description/ 这个题的难点在增加了*,*可能是(也可能是).是(的前提是:右边 ...
- Birthday Paradox
Birthday Paradox Sometimes some mathematical results are hard to believe. One of the common problems ...