Java实现P5710 【深基3.例2】数的性质

在这里插入图片描述

import java.io.IOException;
import java.util.Scanner;

public class Main {
    
    
	@SuppressWarnings("resource")
	public static void main(String[] args) throws IOException{
    
    
		Scanner sc=new Scanner(System.in);
		int x=sc.nextInt();
		int sum=0;
		if(x%2==0) sum+=1;
		if(x>4&&x<=12) sum+=1;
		if(sum==2) {
    
    
			System.out.println("1 1 0 0");
		}else if(sum==1) {
    
    
			System.out.println("0 1 1 0");
		}else {
    
    
			System.out.println("0 0 0 1");
		}
	}
}

思路:分析题目可知Uim会跟小A和八尾勇有重合,因此可以少一种判断,适当优化,当然,直接输出也不是不可。

猜你喜欢

转载自blog.csdn.net/jinyeran/article/details/114610484
今日推荐