Codeforces Beta Round #4 (Div. 2 Only) A. 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
【分析】:给你一个数,能不能分成两个全是偶数的数。
【分析】:暴力枚举或者由偶数只能->偶数+偶数->该数是除了2以外的偶数就输出YES
【代码】:
#include<bits/stdc++.h>
using namespace std; #define LL long long
using namespace std;
int n;
int main()
{
cin>>n;
int f=;
for(int i=;i<=n/;i++)
{
if((i%==)&&((n-i)%==))
{
f=;
break;
}
}
if(f) puts("YES");
else puts("NO");
return ;
}
暴力枚举
#include<bits/stdc++.h>
using namespace std; #define LL long long
using namespace std;
int n;
int main()
{
cin>>n;
int f=;
if(n%==&&n!=)
f=;
if(f) puts("YES");
else puts("NO");
return ;
}
数学
Codeforces Beta Round #4 (Div. 2 Only) A. Watermelon【暴力/数学/只有偶数才能分解为两个偶数】的更多相关文章
- Codeforces Beta Round #4 (Div. 2 Only) A. Watermelon 水题
A. Watermelon 题目连接: http://www.codeforces.com/contest/4/problem/A Description One hot summer day Pet ...
- codeforces水题100道 第二题 Codeforces Beta Round #4 (Div. 2 Only) A. Watermelon (math)
题目链接:http://www.codeforces.com/problemset/problem/4/A题意:一个整数能否表示成两个正偶数的和.C++代码: #include <cstdio& ...
- Codeforces Beta Round #80 (Div. 2 Only)【ABCD】
Codeforces Beta Round #80 (Div. 2 Only) A Blackjack1 题意 一共52张扑克,A代表1或者11,2-10表示自己的数字,其他都表示10 现在你已经有一 ...
- Codeforces Beta Round #83 (Div. 1 Only)题解【ABCD】
Codeforces Beta Round #83 (Div. 1 Only) A. Dorm Water Supply 题意 给你一个n点m边的图,保证每个点的入度和出度最多为1 如果这个点入度为0 ...
- Codeforces Beta Round #79 (Div. 2 Only)
Codeforces Beta Round #79 (Div. 2 Only) http://codeforces.com/contest/102 A #include<bits/stdc++. ...
- Codeforces Beta Round #77 (Div. 2 Only)
Codeforces Beta Round #77 (Div. 2 Only) http://codeforces.com/contest/96 A #include<bits/stdc++.h ...
- Codeforces Beta Round #76 (Div. 2 Only)
Codeforces Beta Round #76 (Div. 2 Only) http://codeforces.com/contest/94 A #include<bits/stdc++.h ...
- Codeforces Beta Round #75 (Div. 2 Only)
Codeforces Beta Round #75 (Div. 2 Only) http://codeforces.com/contest/92 A #include<iostream> ...
- Codeforces Beta Round #74 (Div. 2 Only)
Codeforces Beta Round #74 (Div. 2 Only) http://codeforces.com/contest/90 A #include<iostream> ...
随机推荐
- CSS系列(6) CSS通配符详解
通配符使用星号*表示,意思是“所有的”. 平时使用电脑,比如要搜索C盘里所有的网页,可以使用 *.html来搜索,.html是网页的后缀名,*代表了所有网页的名称: 也就是使用 * 加后缀名,就可以在 ...
- echarts 柱状图下钻功能
var drillDown = { getOption : function () { var option = null; option = { title: { text: ' ...
- UEFI
UEFI,全称Unified Extensible Firmware Interface,即“统一的可扩展固件接口”,是一种详细描述全新类型接口的标准,是适用于电脑的标准固件接口,旨在代替BIOS(基 ...
- install.cloudinit.qga.bat
@echo off title Auto Install color 1F ::CloudBase-Init echo. msiexec /i \\192.168.122.47\cloudbase\C ...
- leetcode_day02
任务二:删除排序数组中的重复项 原文链接:https://leetcode-cn.com/problems/remove-duplicates-from-sorted-array/ 最开始的解决思路: ...
- FTP数字代码的意义
110 重新启动标记应答.120 服务在多久时间内ready.125 数据链路端口开启,准备传送.150 文件状态正常,开启数据连接端口.200 命令执行成功.202 命令执行失败.211 系统状态或 ...
- JavaScript各种数据类型
(一)JavaScript跟Java.Python等语言一样,也是一门编程语言,配合着html,css等可以让画面动起来, 在页面中导入方式主要有两种,如图 可以自己写在文件里面,一般写在body标签 ...
- excel模板解析—桥接模式:分离解析模板和业务校验
在做excel模板解析的时候,其实会有两个部分,第一,将模板读取出来,校验一些必录项等. 但除了这些,在数据真正被业务线使用的时候,还会有一些其他的校验,比如说:根据业务,年龄是不能超过多少岁的,包括 ...
- android自定义SlideMenu
完美解决ListView中子项焦点不可被Touch的BUG. 1.在Ecl ...
- C++ 虚继承内存分配
我们知道,虚继承的基类在类的层次结构中只可能出现一个实例.虚基类在类的层次结构中的位置是不能固定的,因为继承了虚基类的类可能会再次被其他类多继承. 比如class A: virtual T{} 这时T ...