题目描述
一些数字可能拥有以下的性质:
性质 1:是偶数;
性质 2:大于 4 且不大于 12。
小A 喜欢这两个性质同时成立的数字;Uim 喜欢这至少符合其中一种性质的数字;八尾勇喜欢刚好有符合其中一个性质的数字;正妹喜欢不符合这两个性质的数字。
输入格式
输入一个数字 x(0≤x≤1000)x(0\le x \le 1000)x(0≤x≤1000)
输出格式
输出这 4 个人是否喜欢这个数字,如果喜欢则输出1,否则输出0,用空格分隔。
输入输出样例
输入
12
输出
1 1 0 0
import java.util.Scanner;
public class P5710 {
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
System.out.print(A(n)+" "+B(n)+" "+C(n)+" "+D(n));
}
public static int A(int n){
if(n%2==0&&n>4&&n<=12){
return 1;
}
else{
return 0;
}
}
public static int B(int n){
if(n%2==0||(n>4&&n<=12)){
return 1;
}
else{
return 0;
}
}
public static int C(int n){
if(n%2==0^(n>4&&n<=12)){
return 1;
}
else{
return 0;
}
}
public static int D(int n){
if(n%2!=0&&!(n>4&&n<=12)){
return 1;
}
else{
return 0;
}
}
}