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 最坏 ...
随机推荐
- PHP面试题集
汗~~做了一下网络上的php题目,不知不觉做到现在.....把答案贴出来如果有问题请欢迎补充和指正 1.用PHP打印出前一天的时间格式是2006-5-10 22:21:21(2分) $a = da ...
- 在ubuntu上搭建开发环境2---Win7、Ubuntu双系统正确删除Ubuntu
这种删除ubuntu的方式就是针对本博客中搭建双系统的方式:http://www.cnblogs.com/xumenger/p/4459963.html 如果ubuntu不是以wubi方式安装的,那么 ...
- golang debug with LiteIDE
golang 的调试比较麻烦,debug stop into 无法跳转到自己写的代码,但是能够跳转到系统提供的代码. 以下是简单的测试代码: package main import ( "f ...
- gnuplot安装问题(set terminal "unknown")
今天在系统同上要装个gnuplot,原来用的都是拷好的虚拟机.这也是第一次装.本来以为分分钟的事,却不料遇到不少麻烦.记录一下,供大家参考 一,快速开始安装 ubuntu下那自然是: sudo apt ...
- zoj 3888 线段树 ***
卡n^2,用线段树降到nlogn 记录每个点上所覆盖线段的次小值,保证能有两条路径能走 #include<cstdio> #include<iostream> #include ...
- 直传文件到Azure Storage的Blob服务中
(此文章同时发表在本人微信公众号“dotNET每日精华文章”,欢迎右边二维码来关注.) 题记:为了庆祝获得微信公众号赞赏功能,忙里抽闲分享一下最近工作的一点心得:如何直接从浏览器中上传文件到Azure ...
- [荐]js模版引擎handlebars.js
[官方介绍:http://handlebarsjs.com/] Handlebars provides the power necessary to let you build semantic te ...
- matlab报错
这可能说明..压根就没有这个函数
- ettercap局域网内DNS欺骗(隔壁的哥们轻一点 ...)
转自:http://www.cnblogs.com/hkleak/p/5043063.html 笔记一:ettercap是什么? 我们在对WEB安全检测的时候都会用到Cain和netfuke这两款工具 ...
- popupwindow点击空白处如何自动消失?
Popupwindow如果需要点击空白处自动消失,需要设置两个函数 1.customPopWindow.setFocusable(true);该函数也可以在构造函数中设置,如:mPopupWindow ...