Codeforces Round #248 (Div. 2) A. Kitahara Haruki's Gift
解决思路是统计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的更多相关文章
- 水题 Codeforces Round #286 (Div. 2) A Mr. Kitayuta's Gift
题目传送门 /* 水题:vector容器实现插入操作,暴力进行判断是否为回文串 */ #include <cstdio> #include <iostream> #includ ...
- Codeforces Round #248 (Div. 2) (ABCD解决问题的方法)
比赛链接:http://codeforces.com/contest/433 A. Kitahara Haruki's Gift time limit per test:1 second memory ...
- Codeforces Round #248 (Div. 2) C. Ryouko's Memory Note
题目链接:http://codeforces.com/contest/433/problem/C 思路:可以想到,要把某一个数字变成他的相邻中的数字的其中一个,这样总和才会减少,于是我们可以把每个数的 ...
- Codeforces Round #248 (Div. 2)C 题
题目:http://codeforces.com/contest/433/problem/C 没想到做法就各种纠结, 今天做的都快疯掉了, 太弱了, 等题解一出,就各种恍然大悟 不应该不应该 正文: ...
- 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 ...
- 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 ...
- Codeforces Round #248 (Div. 2) B称号 【数据结构:树状数组】
主题链接:http://codeforces.com/contest/433/problem/B 题目大意:给n(1 ≤ n ≤ 105)个数据(1 ≤ vi ≤ 109),当中有m(1 ≤ m ≤ ...
- Codeforces Round #248 (Div. 2) B. Kuriyama Mirai's Stones
题目简单描述就是求数组中[l,r]区间的和 #include <iostream> #include <vector> #include <string> #inc ...
- Codeforces Round #248 (Div. 2) C. Ryouko's Memory Note (vector 替换)
题目链接 题意:给m个数字, 这些数字都不大于 n, sum的值为相邻两个数字 差的绝对值.求这n个数字里把一个数字 用 其中另一个数字代替以后, 最小的sum值. 分析:刚开始以为两个for 最坏 ...
随机推荐
- windows重新获取IP
win+r------->cmd------>ipconfig /release (释放ip) ipconfig /renew 重新获取ip
- HTTP1.0和HTTP1.1的主要区别是
HTTP/.0协议使用非持久连接,即在非持久连接下,一个tcp连接只传输一个Web对象 HTTP/.1默认使用持久连接(然而,HTTP/.1协议的客户机和服务器可以配置成使用非持久连接)在持久连接下, ...
- Q3 2016 State of the Internet – Security Report
https://content.akamai.com/PG7476-Q3-2016-SOTI-Security-Report.html?utm_source=GoogleSearch&gcli ...
- MongoDB增删查改
1.insert db.Customers.insert({ "DateTest":new Date(), "IntTest":32, "Double ...
- PHPCMS 实现上一篇、下一篇
方法一:直接调用phpcms系统的函数 <div class="info"> <span>上一篇:<a href="{$previous_p ...
- pthread_create传递参数
转自:http://blog.csdn.net/yeyuangen/article/details/6757525 #include <iostream> #include <pth ...
- android之HttpURLConnection(转)
android之HttpURLConnection 1.HttpURLConnection连接URL1)创建一个URL对象 URL url = new URL(http://www.baidu.com ...
- matlab练习程序(简单多边形的核)
还是计算几何, 多边形的核可以这样理解:这个核为原多边形内部的一个多边形,站在这个叫核的多边形中,我们能看到原多边形的任何一个位置. 算法步骤如下: 1.根据原多边形最大和最小的x,y初始化核多边形, ...
- Linux crontab 定时任务详解
1.每小时执行一次脚本 * */1 * * * /etc/init.d/smb restart #不是所有的系统都支持“*/1”这种写法可以试试: 0 * * * * /etc/init.d/smb ...
- CDN网络的原理
来源:http://blog.csdn.net/coolmeme/article/details/9468743 版权声明:本文为博主原创文章,未经博主允许不得转载. 1.用户向浏览器输入www.we ...