T1-1第一题吃瓜问题CodeForces - 4A amc第一
2018-12-09 本文已影响0人
xcpooo
Input
The first (and the only) input line contains integer number w (1 ≤ w ≤ 100) — the weight of the watermelon bought by the boys.
Output
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.
#include<iostream>
using namespace std;
int main() {
int a;
cin >> a;
if (a == 2)cout << "NO";//如果质量是整数2,分成两部分是1+1,都是单数
else if (a % 2 == 0) cout << "YES";
else cout << "NO";
return 0;
}