#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)的更多相关文章

  1. CodeForces 839C - Journey | Codeforces Round #428 (Div. 2)

    起初误以为到每个叶子的概率一样于是.... /* CodeForces 839C - Journey [ DFS,期望 ] | Codeforces Round #428 (Div. 2) */ #i ...

  2. CodeForces 839D - Winter is here | Codeforces Round #428 (Div. 2)

    赛后听 Forever97 讲的思路,强的一匹- - /* CodeForces 839D - Winter is here [ 数论,容斥 ] | Codeforces Round #428 (Di ...

  3. 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 ...

  4. Codeforces Round #428 (Div. 2) 题解

    题目链接:http://codeforces.com/contest/839 A. Arya and Bran 题意:每天给你一点糖果,如果大于8个,就只能给8个,剩下的可以存起来,小于8个就可以全部 ...

  5. 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 ...

  6. Codeforces Round #428 (Div. 2)E. Mother of Dragons

    http://codeforces.com/contest/839/problem/E 最大团裸题= =,用Bron–Kerbosch算法,复杂度大多博客上没有,维基上查了查大约是O(3n/3) 最大 ...

  7. 【Codeforces Round #428 (Div. 2) B】Game of the Rows

    [Link]:http://codeforces.com/contest/839/problem/B [Description] 给你n排的如题目所示的位置; 同一排中(1,2) 算相邻; (3,4) ...

  8. 【Codeforces Round #428 (Div. 2) C】Journey

    [Link]:http://codeforces.com/contest/839/problem/C [Description] 给一棵树,每当你到一个点x的时候,你进入x的另外一每一个出度的概率都是 ...

  9. 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 ...

随机推荐

  1. 前台使用load一个集合后台接受的方法

    前台: var imageCaseList = []; }; imageCaseList.push(data); $('#showData').load(url, { querys: imageCas ...

  2. 2018.6.15 Java对象序列化详解

    一.定义 Serializable 序列化:把Java对象转换为字节序列的过程. 反序列化:把字节序列恢复为Java对象的过程. ObjectOutputStream对象输出流 可以将实现了Seria ...

  3. 2018.5.28 Oracle数据库补充

    select * from (select rownum rn,e2.* from (select e1.* from emp e1)e2 where rownum<=10)e3 where e ...

  4. python的对数

    python的对数 首先要导入 math 模块: import math import numpy as np math.log(8,2),此为以2为底8的对数 等于 math.log2(8); 等于 ...

  5. mysql基础,数据表的类型

  6. 八、Linux 用户和用户组管理

    Linux 用户和用户组管理 Linux系统是一个多用户多任务的分时操作系统,任何一个要使用系统资源的用户,都必须首先向系统管理员申请一个账号,然后以这个账号的身份进入系统. 用户的账号一方面可以帮助 ...

  7. 同时启动多个tomcat的配置信息

    同时启动多个tomcat的配置信息 下面把该配置文件中各端口的含义说明下. <Server port="8005" shutdown="SHUTDOWN" ...

  8. 【JAVA】JVM常用工具

    JDK内置工具使用 jps(Java Virtual Machine Process Status Tool)    查看所有的jvm进程,包括进程ID,进程启动的路径等等. jstack(Java ...

  9. 用django实现邮件发送

    settings配置 EMAIL_HOST = 'smtp.qq.com' # 如果是163换成stmp.163.com EMAIL_PORT = 465 # qq邮箱的端口 EMAIL_HOST_U ...

  10. django之media配置

    一.没有配置Media avatar = models.FileField(upload_to='avatars/', default='/avatars/default.png') # 储存头像的m ...