T1-1第一题吃瓜问题CodeForces - 4A amc第一次考试2018.12.8

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
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;
}

你可能感兴趣的:(T1-1第一题吃瓜问题CodeForces - 4A amc第一次考试2018.12.8)