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] 这 ...
随机推荐
- WPF的MVVM
一.关于WPF WPF(Windows Presentation Foundation) ,从名字来看,Microsoft想把WPF技术作为Windows程序外观(表现层)的基础.我们知道,现在开发 ...
- Apriori算法实现
Apriori算法原理:http://blog.csdn.net/kingzone_2008/article/details/8183768 import java.util.HashMap; imp ...
- 管道是如何处理HTTP请求的?
管道是如何处理HTTP请求的? 我们知道ASP.NET Core请求处理管道由一个服务器和一组有序的中间件组成,所以从总体设计来讲是非常简单的,但是就具体的实现来说,由于其中涉及很多对象的交互,我想很 ...
- 慎用MonthsBetweent和MonthSpan
●function MonthsBetween(const ANow, AThen: TDateTime): Integer; 描述: 根据两个给定的TDateTime类型的参数ANow和AThen, ...
- HDU 4869 Turn the pokers (2014 多校联合第一场 I)
HDOJ--4869--Turn the pokers[组合数学+快速幂] 题意:有m张扑克,开始时全部正面朝下,你可以翻n次牌,每次可以翻xi张,翻拍规则就是正面朝下变背面朝下,反之亦然,问经过n次 ...
- 循环json数据的列
var len = json.length; for (var i = 0; i < len; i++) { for (obj in json[i]) { var obj2 = ...
- android平台中,EventBus研究学习
当一个Android应用功能越来越多的时候.app中各个部分之间通信.往往採用Observer的方式来进行,即注冊----通知----注销的方式运行 各类控件常常须要依据某个状态来更 ...
- 推荐一个第三方Qt库的集合
https://inqlude.org/ Stable libraries | Development versions | Unreleased | Commercial | All attica ...
- [计算机基础]URI与URL
URI : uniform resource identifier统一资源标示符用于指定Web资源的字符串,它定义了Web资源中的各个不同的部分.ex:http://example.org/absol ...
- 关于jquery文件上传插件 uploadify 3.1的使用
要使用uplaodify3.1,自然要下载相应的包,下载地址http://www.uploadify.com/download/,这里有两种包,一个是基于flash,免费的,一个是基于html5,需要 ...