天天看點

A. Watermelon

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 的方式做選擇表達。