3619 - B
有一天,黑黑和白白在外面玩,玩了一会,黑黑的肚子突然饿了,和白白商量了一下,他们买来了一张重n kg 的大饼。由于他们都是偶数的超级粉丝,所以分开的两半也必须是偶数kg。现在给你大饼的重量,你来告诉他们是否能够把饼分成他们需要的样子。
Input
一个整数w(1 <= w <= 100)代表大饼的重量。
Output
如果能分成功,输出“YES”,否则输出“NO”(都不带引号)
Examples
Input
8
Output
YES
Solution C
#include <stdio.h> int main() { int w; int i; int flag; while(~scanf("%d",&w)) { flag = 0; for(i = 2;i < w;i += 2) if(i % 2 == 0 && (w - i) % 2 == 0) { flag = 1; } if(flag) printf("YES\n"); else printf("NO\n"); } return 0; }
Solution C++
#include<cstdio> #include<cstdlib> #include<cstring> #include<cctype> #include<cmath> #include<algorithm> #include<iostream> #include<string> #include<vector> #include<bitset> #include<queue> #include<stack> #include<list> #include<map> #include<set> #define TEST #define LL long long #define Mt(f, x) memset(f, x, sizeof(f)); #define rep(i, s, e) for(int i = (s); i <= (e); ++i) #ifdef TEST #define See(a) cout << #a << " = " << a << endl; #define See2(a, b) cout << #a << " = " << a << ' ' << #b << " = " << b << endl; #define debug(a, s, e) rep(_i, s, e) {cout << a[_i] << ' ';} cout << endl; #define debug2(a, s, e, ss, ee) rep(i_, s, e) {debug(a[i_], ss, ee)} #else #define See(a) #define See2(a, b) #define debug(a, s, e) #define debug2(a, s, e, ss, ee) #endif // TEST const int MAX = 2e9; const int MIN = -2e9; const double eps = 1e-8; const double PI = acos(-1.0); using namespace std; int main() { int n; // freopen("in.txt", "r", stdin); // freopen("out.txt", "w", stdout); while(~scanf("%d", &n)) { if(n == 2) { printf("NO\n"); continue; } printf("%s\n", n % 2 ? "NO" : "YES"); } return 0; }