『算法-ACM竞赛-真题』ThePreliminaryContestforICPCAsiaXuzhou2019徐州网络赛CBuyWatermelon

『算法-ACM 竞赛-真题』ThePreliminaryContestforICPCAsiaXuzhou2019 徐州网络赛 CBuyWatermelon

The Preliminary Contest for ICPC Asia Xuzhou 2019 徐州网络赛 C Buy Watermelon

The hot summer came so quickly that Xiaoming and Xiaohong decided to buy a big and sweet watermelon. But they are two very strange people. They are even-numbered enthusiasts. They want to cut the watermelon in two parts, and each part weighs two times as much as a kilogram .They quickly decide which melon to buy. Do you know if you want to buy this melon?

Input

Only one line contains one integer ww (1\leq w\leq 100)(1≤w≤100),units are kilograms.

Output

If it can meet the requirements, you will output YES, otherwise output NO.

样例输入复制

8

样例输出复制

YES

这个题判断能不能把这个数分成两个偶数,然后一开始以为是对半分,WA 了一发,后来发现不是,那么任意分的话除了 2 的所有的偶数都可以。

#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
#define N 100010
using namespace std;
int main()
{   int w;
    cin>>w;
    if(w==2||w%2)cout<<"NO"<<endl;
    else cout<<"YES"<<endl;
}

『算法-ACM竞赛-真题』ThePreliminaryContestforICPCAsiaXuzhou2019徐州网络赛CBuyWatermelon
https://chiamzhang.github.io/2024/06/29/『算法-ACM竞赛-真题』ThePreliminaryContestforICPCAsiaXuzhou2019徐州网络赛CBuyWatermelon/
Author
Chiam
Posted on
June 29, 2024
Licensed under