普通闰年(y%4 == 0 && y%100 != 0),世纪闰年(y%400 == 0):

import java.util.*;
public class Main {
    public static void main(String[] args) throws Exception{
        Scanner sc = new Scanner(System.in);
        int[] a = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};    //平年
        int[] b = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};    //闰年
        while(sc.hasNextLine()){
            String[] s = sc.nextLine().split(" ");
            int y = Integer.parseInt(s[0]);
            int m = Integer.parseInt(s[1]) - 1;
            int d = Integer.parseInt(s[2]);
            int sum = 0;
            int[] v;
            if((y%4 == 0 && y%100 != 0)||(y%400 == 0)) v = b;    //闰年
            else v = a;
            for(int i = 0; i < m; ++i) sum += v[i];    //各月天数直接累加即可
            sum += d;
            System.out.println(sum);
        }
    }
}