解决思路是统计100的个数为cnt1,200的个数为cnt2

cnt1    cnt2

奇数      奇数

奇数      偶数

偶数      奇数

偶数     偶数

当cnt1为奇数时一定剩余一个100,不能均分,所以输出结果为NO

当cnt1为偶数且cnt2为偶数则肯定能均分

当cnt1为偶数且cnt2为奇数时

如果有至少两个100,则取出2个100,转换成200,则cnt2就是偶数,而cnt1也是偶数,可以均分

  否则没有两个100,则cnt2是奇数不能均分

#include <iostream>
using namespace std; int main(){
int n;
cin >> n;
int cnt1 = , cnt2 = ,weight;
for(int i = ; i < n ; ++ i){
cin >> weight;
if(weight == ) cnt1++;
else cnt2++;
}
if(cnt1%) cout<<"NO"<<endl;
else{
if(cnt2% == ) cout<<"YES"<<endl;
else{
cnt1/=;
if(!cnt1) cout<<"NO"<<endl;
else cout<<"YES"<<endl;
}
}
}

Codeforces Round #248 (Div. 2) A. Kitahara Haruki's Gift的更多相关文章

  1. 水题 Codeforces Round #286 (Div. 2) A Mr. Kitayuta's Gift

    题目传送门 /* 水题:vector容器实现插入操作,暴力进行判断是否为回文串 */ #include <cstdio> #include <iostream> #includ ...

  2. Codeforces Round #248 (Div. 2) (ABCD解决问题的方法)

    比赛链接:http://codeforces.com/contest/433 A. Kitahara Haruki's Gift time limit per test:1 second memory ...

  3. Codeforces Round #248 (Div. 2) C. Ryouko's Memory Note

    题目链接:http://codeforces.com/contest/433/problem/C 思路:可以想到,要把某一个数字变成他的相邻中的数字的其中一个,这样总和才会减少,于是我们可以把每个数的 ...

  4. Codeforces Round #248 (Div. 2)C 题

    题目:http://codeforces.com/contest/433/problem/C 没想到做法就各种纠结, 今天做的都快疯掉了, 太弱了, 等题解一出,就各种恍然大悟 不应该不应该 正文: ...

  5. Codeforces Round #248 (Div. 1) B. Nanami's Digital Board 暴力 前缀和

    B. Nanami's Digital Board 题目连接: http://www.codeforces.com/contest/434/problem/B Description Nanami i ...

  6. Codeforces Round #248 (Div. 1) A. Ryouko's Memory Note 水题

    A. Ryouko's Memory Note 题目连接: http://www.codeforces.com/contest/434/problem/A Description Ryouko is ...

  7. Codeforces Round #248 (Div. 2) B称号 【数据结构:树状数组】

    主题链接:http://codeforces.com/contest/433/problem/B 题目大意:给n(1 ≤ n ≤ 105)个数据(1 ≤ vi ≤ 109),当中有m(1 ≤ m ≤  ...

  8. Codeforces Round #248 (Div. 2) B. Kuriyama Mirai's Stones

    题目简单描述就是求数组中[l,r]区间的和 #include <iostream> #include <vector> #include <string> #inc ...

  9. Codeforces Round #248 (Div. 2) C. Ryouko's Memory Note (vector 替换)

    题目链接 题意:给m个数字, 这些数字都不大于 n,  sum的值为相邻两个数字 差的绝对值.求这n个数字里把一个数字 用 其中另一个数字代替以后, 最小的sum值. 分析:刚开始以为两个for 最坏 ...

随机推荐

  1. 如何在elasticsearch中查看Logstash打到elasticsearch的数据

    # cat syslog02.conf #filename:syslog02.conf #注意这个是要用#号注释掉 input{ file{ path => ["/var/log/*. ...

  2. CLR via C#(04)- 本是同根生

    一.等值性——Equals()方法 有时候我们需要比较两个对象是否相等,比如在一个ArrayList中进行排序查找等操作时. System.Object提供了Equals()虚方法: class Ob ...

  3. css控制文字显示长度,超过用省略号替代

    .line_text { width:200px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; } <span cl ...

  4. 【ubuntu 】常见错误--Could not get lock /var/lib/dpkg/lock

    ubuntu 常见错误--Could not get lock /var/lib/dpkg/lock 通过终端安装程序sudo apt-get install xxx时出错: E: Could not ...

  5. 自制工具:迅速打开一个Node 环境的Playground

    需求 经常有这种情况,写代码的时候需要实验种想法,亟需一种playground 环境来玩耍.如果是前端的话可以打开chrome 的控制台,但是如果是Node 的话就比较麻烦了.我要打开我的存放试验代码 ...

  6. 攻城狮在路上(壹) Hibernate(十六)--- Hibernate声明数据库事务

    一.数据库事务的概念: 数据库的ACID特征:Atomic.Consistency.Isolation.Durability.原子性.一致性.隔离性.持久性.不同的隔离级别引发的不同问题. 事务的AC ...

  7. 注解:【基于外键的】Hibernate单向1->1关联

    Person与Address关联:单向1->1,[基于外键的] Person.java package org.crazyit.app.domain; import javax.persiste ...

  8. Arduino101学习笔记(十四)—— Flash库

    一.一些API 1.打开文件 SerialFlashFile file; file = SerialFlash.open("filename.bin"); if (file) { ...

  9. 智能车学习(七)——按键矩阵的实现

    一.原理说明 就是按键矩阵代码书写的一个说明,就是讲K5到K7先输出高电平,而K1和K4则调成上拉输入,如果检测到K1到K4有一个变为0,说明有按键按下去,立刻进行转换,是的K1到K4设置为输出高电平 ...

  10. Liferay 6.2 改造系列之四:重新整理Application添加页面默认提供的Portlet清单

    经过2.3两步后,剩余Portlet已经不多,添加Application页面如下: 将用不到的Portlet隐藏起来:11   Portal目录 (Portal Directory) 将内嵌Protl ...