美文网首页编程练习
codeforces 4A (math,brute force)

codeforces 4A (math,brute force)

作者: codinRay | 来源:发表于2017-03-29 21:40 被阅读0次

    http://codeforces.com/problemset/problem/4/A

    生词:
    even number 偶数
    odd number 奇数

    题面:
    判断一个数是否能拆成2个偶数。

    直接暴力,从2~w-2每个数判断。

    // codeforces
    // 4A 
    // math, brute force
    #include <iostream>
    using namespace std;
    int main() {
        int w;
        while (cin >> w) {
            bool f = false;
            for (int i = 2; i <= w - 2; i += 2) {
                if (!(i & 1) && !((w - i) & 1)) {
                    f = true;
                    break;
                }
            }
            cout << (f ? "YES" : "NO") << '\n';
        }
        return 0;
    }
    

    相关文章

      网友评论

        本文标题:codeforces 4A (math,brute force)

        本文链接:https://www.haomeiwen.com/subject/pjbyottx.html