본문 바로가기

알고리즘/Java

(JAVA) 백준 알고리즘 2단계 2753번 : 윤년

문제 조건에서 한번 삐끗

입력 조건(1<=a<=4000) 입력 안해도 정답 처리 됌

 

소스

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import java.util.Scanner;
public class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
            int a = scan.nextInt();
        if(1<=&& a<=4000){
                if(a%4==0){
                    if(a%100!=0 || a%400==0){
                        System.out.println('1');
                    }else{
                        System.out.println('0');
                    }
                }else{
                    System.out.println('0');
                }
        }
    }
}
http://colorscripter.com/info#e" target="_blank" style="color:#e5e5e5text-decoration:none">Colored by Color Scripter