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; }
标签:buy,Contest,two,Asia,Buy,watermelon,They,melon,include 来源: https://blog.csdn.net/weixin_43627118/article/details/100605026