A - うるう年 / AtCoderRegularContest#002

arc002.contest.atcoder.jp

import java.io.*;
import java.util.*;

public class Main   {
    public static int Y;
    public static boolean flg;

    private void Input()  {
        Scanner sc = new Scanner(System.in);
        Y = Integer.parseInt( sc.next() );
    }

    private boolean isLeap()   {
        if ( Y%400==0 || (Y%100!=0 && Y%4==0) ) return true;
        else    return false;
    }

    private void Solve() {
        flg = new Main().isLeap();
    }

    private void Output() {
        PrintWriter pw = new PrintWriter(System.out);

        if (flg)    pw.println("YES");
        else    pw.println("NO");
        pw.flush();
    }

    public static void main(String[] args) throws Exception {
        Main instance = new Main();

        instance.Input();
        instance.Solve();
        instance.Output();
    }
}

400で割り切れるか、100で割り切れなくて4で割り切れる場合は、うるう年なのでYESを出力。それ以外はNOを出力。
〜了〜