C语言题目集-分西瓜

Statement

Neptune 和 Nepgear 买了一个西瓜,重量为 n。

Neptune 和 Nepgear 打算吃掉这个西瓜。在此之前,Neptune 和 Nepgear 希望把西瓜切成两块。

现在,Neptune 和 Nepgear 想要知道,是否存在一种切法,使得得到的两块西瓜重量都是偶数。

Neptune 和 Nepgear 当然会这个问题,但 Neptune 和 Nepgear 想考考你,所以 Neptune 和
Nepgear 希望你能解决这个问题。

Input

第一行包含一个整数 n (1 <= n <= 100),代表 Neptune 和 Nepgear 的西瓜的重量。

Output

如果期望的切法存在,输出YES;否则输出NO。

Example

Input

8

Output

YES

Note

在样例中,Neptune 和 Nepgear 可以把西瓜切成重量分别为 4 和 4 的两块,或者把西瓜切成重量分别为 2 和 6 的两块。

#include<stdio.h>
int main()
{
    
    
	int x;
	scanf("%d",&x);
	for(int i=1;i<=x/2;i++)
	{
    
    
		if(i%2==0&&(x-i)%2==0)
		{
    
    
			printf("YES");
			return 0;
		}
	}
	printf("NO");
 } 

猜你喜欢

转载自blog.csdn.net/weixin_51198300/article/details/113723751