分油
Problem Description
有一天,BK学长和calm学长合伙卖油,直到傍晚他们还有n斤油没有卖出去,他们打算收工,在分完钱后开始分油,他们都很慷慨,不一定要一人一半,但是他们都想要正偶数斤油,但是他们不知道怎么分,恰好聪明的你路过了,所以你应该告诉他们能不能分?
Input
多组输入
第一行输入一个整数n(1≤n≤1000)
Output
如果可以分输出"YES",否则输出"NO",你的输出没有引号,行末换行
Sample Input
8
Sample Output
YES
#include<stdio.h>
int main()
{
int n;
while(scanf("%d", &n)!=EOF)
{
if (n % 2==0 && n!=2)
{
printf("YES\n");
}
else
{
printf("NO\n");
}
}
return 0;
}
糖果风波
Problem Description
有n颗一模一样的糖果,分给calm学长和BK学长,问有多少种方法使得两人都可以获得正整数的糖果?
Input
多组输入
每行一个正整数n,1≤n≤20
Output
对应每个n输出相应的答案,行末换行。
Sample Input
2
Sample Output
1
#include <stdio.h>
int main()
{
int n;
while(scanf("%d",&n)!= EOF)
{
printf("%d\n",n-1);
}
return 0;
}