哈理工OJ 1380 Vagaa, eMule and Apple(水题)

题目链接:http://acm.hrbust.edu.cn/index.php?m=ProblemSet&a=showProblem&problem_id=1380

Vagaa, eMule and Apple
Time Limit: 1000 MS Memory Limit: 65536 K
Total Submit: 136(76 users) Total Accepted: 72(67 users) Rating: Special Judge: No
Description
Vagaa is a strange dog and eMule is a strange mule. They are friends.

They love apples and math.

One day, they buy a big apple which weighs w kilos. They wonder whether they can divide it into exactly two parts in a way that each part weighs even number of kilos.

Input
There are multiple test cases. The first line of input is an integer T indicating the number of test cases. Then T test cases follow.

For each test case:

Line 1. This line contains an integer w (1 ≤ w ≤ 100).

Output
For each test case:

Line 1. Output “YES” if they can, otherwise output “NO”.

Sample Input
1

10

Sample Output
YES

Hint
In the sample, they can divide the apple into two parts of 2 and 8 kilos.

Source
哈理工2012春季校赛 - 现场赛(热身)
Author
齐达拉图@HRBUST

【中文题意】大致转化过来的意思就是给你一个整数问你是否可以把它分解为两个偶数的和。
【思路分析】除了2以外,所有的正偶数都可以分为两个正整数的和,直接特判一下就好了。
【AC代码】

#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;

int main()
{
    int t,n;
    scanf("%d",&t);
    while(t--)
    {
        scanf("%d",&n);
        if(n%2==0&&n!=2)
        {
            printf("YES\n");
        }
        else
        {
            printf("NO\n");
        }
    }
    return 0;
}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值