Vagaa, eMule and Apple
2015-10-10 18:46
330 查看
Vagaa, eMule and Apple | ||||||
| ||||||
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 |
#include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;
int main()
{
int T;
while(~scanf("%d",&T))
{
while(T--)
{
int n;
scanf("%d",&n);
int i;
int key=0;
for(i=2;i<=n/2;i+=2)
{
if((n-i)%2==0)
{
key=1;
break;
}
}
if(key==1)
{
cout<<"YES"<<endl;
}
else
{
cout<<"NO"<<endl;
}
}
}
return 0;
}
相关文章推荐
- Android Custom View NullPointerException
- android 5.0新特性 RecyclerView使用初级
- Android——在一个Activity中如何启动另外一个Activity
- 找Android程序登录按钮事件
- Android Tips
- 招商银行支付时WebView无法加载证书
- Objective-C 编码规范(一)
- Android Environment类的接口详解
- 移动端页面开发总结[摘录]
- Android 禁止屏幕旋转 和 旋转屏幕时保持Activity
- Android 源码获取——在Windows环境下通过Git得到Android源代码
- Android中的GraphicBuffer同步机制-Fence
- Android之菜单总结
- iOS---tableview加载图片的时候的优化之lazy(懒加载)模式and异步加载模式
- Unity3D 物体移动方式总结
- Monitor Object Monitors with Eclipse Object Monitor Monitors
- Android基础
- Objective-C字符串NSString与NSMutableString
- Android Studio in OSX 提高工作效率的快捷键
- AudioService 之 AudioFocus简单例子