본문 바로가기

[BOJ] - JAVA

[백준] 2753 : 윤년 JAVA 풀이

import java.util.Scanner;
public class Main{
    public static void main(String[] args){
        Scanner in = new Scanner(System.in);
        int year = in.nextInt();
        
        if(year%4==0){
            if(year%400==0){
                System.out.println('1');
            }
            else if(year%100!=0){
                System.out.println('1');
            }
            else{
                System.out.println('0');
            }
        }
        else{
            System.out.println('0');
        }
    }
}