Codeforces 4A-Watermelon(意甲冠军)
1 second
64 megabytes
standard input
standard output
One hot summer day Pete and his friend Billy decided to buy a watermelon. They chose the biggest and the ripest one, in their opinion. After that the watermelon was weighed, and the scales showed w kilos.
They rushed home, dying of thirst, and decided to divide the berry, however they faced a hard problem.
Pete and Billy are great fans of even numbers, that's why they want to divide the watermelon in such a way that each of the two parts weighs even number of kilos, at the same time it is not obligatory that the parts are equal. The boys are extremely tired and
want to start their meal as soon as possible, that's why you should help them and find out, if they can divide the watermelon in the way they want. For sure, each of them should get a part of positive weight.
The first (and the only) input line contains integer number w (1 ≤ w ≤ 100)
— the weight of the watermelon bought by the boys.
Print YES, if the boys can divide the watermelon into two parts, each of them weighing even number of kilos; and NO in
the opposite case.
8
YES
恩 看懂题意就能做。
题意:把一个分为两个偶数之和。假设能够分。输出YES 否则输出NO
值得注意的这道题的背景是两个人分西瓜。所以每一个人至少分到一磅,so 0的情况就要排除掉,尽管0也是偶数
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
using namespace std;
#define LL long long
int main()
{
int n;
while(cin>>n)
{
int flag=0;
for(int i=1;i<=n-1;i++)
if(i%2==0&&(n-i)%2==0)
{
flag=1;
break;
}
if(flag)
puts("YES");
else
puts("NO");
}
return 0;
}
版权声明:本文博客原创文章,博客,未经同意,不得转载。
Codeforces 4A-Watermelon(意甲冠军)的更多相关文章
- Codeforces 9A-Die Roll(意甲冠军)
A. Die Roll time limit per test 1 second memory limit per test 64 megabytes input standard input out ...
- CodeForces 4A
A A - Water~melon Time Limit:1000MS Memory Limit:65536KB 64bit IO Format:%I64d & %I64u Submit St ...
- 4A Watermelon
A. Watermelon time limit per test 1 second memory limit per test 64 megabytes input standard input o ...
- Codeforces - A. Watermelon
A. Watermelon time limit per test 1 second memory limit per test 64 megabytes input standard input o ...
- Watermelon -- codeforces
http://acm.hust.edu.cn/vjudge/contest/view.action?cid=93241#problem/A (654123) http://codeforces.co ...
- Codeforces初体验
Codeforces印象 这两天抽时间去codeforces体验了一把. 首先,果然有众多大牛存在.非常多名人一直參加每周一次的比赛.积分2000+,并參与出题. 另外.上面题目非常多.预计至少一千题 ...
- Codeforces 475C Kamal-ol-molk's Painting 模拟
主题链接:点击打开链接 意甲冠军:特定n*m矩阵 X代表色 .代表无色 随着x*y形刷子去涂色. 刷子每次能够→或↓移动随意步. 若可以染出给定的矩阵,则输出最小的刷子的面积 若不能输出-1 思路: ...
- Codeforces 39E What Has Dirichlet Got to Do with That? 游戏+内存搜索
主题链接:点击打开链接 意甲冠军: 特定 a一箱 b球 不变n (球和箱子都不尽相同,样的物品) 设 way = 把b个球放到a个箱子中的方法数, 若way >= n则游戏结束 有2个人玩游戏. ...
- CodeForces 484B Maximum Value
意甲冠军: a序列n(2*10^5)数字 问道a[i]>=a[j]如果是 a[i]%a[j]最大值是多少 思路: 感觉是一道挺乱来的题-- 我们能够将ans表示为a[i]-k*a[j] 这 ...
随机推荐
- 【JAVA学习】单例模式的七种写法
尊重版权:http://cantellow.iteye.com/blog/838473 第一种(懒汉.线程不安全): Java代码 public class Singleton { private ...
- CSDN头版头条 《近匠》 Wijmo 5 CTO:从Web到移动,我的25年编程生涯
现年52岁的Bernardo Castilho先生是GrapeCity(中文名为葡萄城)ComponentOne公司的CTO,在与他的对话过程中.充满风趣严谨和厚重的历史感. 当作为年轻人的我们崇拜着 ...
- 中科同向备份软件Heartsone-backup(足足16个软件,可差异化备份虚拟机)
传统的备份方式我们应该尽量避免,除非他们支持和执行使用基于(API)的虚拟环境中的管理备份.中科同向备份软件Heartsone-backup V8.0(以下简称HBU)就是通过VADP提供的一系列管理 ...
- qt button以及label实现不规则图形(五种方法:使用QSS,设置Mask图片,自己画)
1.方法1:准备一张边界是透明的不规则图形 QPushButton * pbtn = new QPushButton; pbtn->setStyleSheet("QPushBut ...
- Visual Studio 控件命名规范(很详细)
VS 控件命名规范 Type Prefix Example Array arr arrShoppingList Boolean bln blnIsPostBack Byte byt bytPixelV ...
- Lucene.Net 2.3.1开发介绍 —— 三、索引(六)
原文:Lucene.Net 2.3.1开发介绍 -- 三.索引(六) 2.2 Field的Boost 如果说Document的Boost是一条线,那么Field的Boost则是一个点.怎么理解这个点呢 ...
- SDL Guide 中文译版
SDL即Simple DirectMedia Layer,类似DirectX,是完整的游戏.多媒体开发包,但不同的是它跨越几乎所有的平台,有各种语言的接口,多种语言的文档,而这一切都是广大志愿者完成的 ...
- script:查看历史sql执行信息
script:查看历史sql执行信息 SELECT * FROM (SELECT '1.v$sql'||'实例号:'||GV$SQL.inst_id source, ...
- 线段树菜鸟一题+归并排序【求逆序数】POJ2299
题目链接:http://poj.org/problem?id=2299 归并排序解法链接:http://blog.csdn.net/lyy289065406/article/details/66473 ...
- 监控apache虚拟主机进程
mod_status模块能输出例如以下内容: 正在伺服请求的工作者(线程或进程)数量 空暇的工作者数量 每一个工作者的状态:已完毕的请求数.已发送的字节数.(*) 总訪问数和已发送的字节总数(*) s ...