One hot summer day Pete and his friend Billy decided to buy a watermelonAfter that the watermelon was weighed, and the scales showed w kilos. they want to divide the watermelon in such a way that each of the two parts weighs even number of kilos, at the same time it is not obligatory that the parts are equal.

问题简述:

将一个西瓜分成两部分且两部分不相等。如果满足条件,就输出YES,否则输出NO。

问题分析:

西瓜重w千克,满足条件时,w是偶数,即w%2=0;w的两部分步不等,简单理解是w!=2.其他的偶数能等于两个相异的数之和。

程序说明:

使用了一个判断语句,可以选用if 或if …else 的方式做选择表达。

AC的C++程序如下:

A. Watermelon_c++程序