题解 | #吃瓜群众#

吃瓜群众

https://ac.nowcoder.com/acm/problem/22014

题目是基本的输入输出问题,首先要明白西瓜能分成两份都是偶数(2m和2n),则本身瓜就是偶数(2(m+n)),但是我犯了一个小错误,2也是偶数,但它并不能分为两个偶数!!
注意到这个点其它就都很容易了啦!!

#include<stdio.h>
int main(void){
    int weight;
    scanf("%d",&weight);
    if(weight%2==0&&weight>2) printf("YES, you can divide the watermelon into two even parts.");
    else printf("NO, you can't divide the watermelon into two even parts.");
}
全部评论

相关推荐

点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务