选择题
编程题
题目1
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
//读入年月日(字符串形式读入)
Scanner sc = new Scanner(System.in);
String s = sc.nextLine();
String[] ss = s.split(" ");
int[] date = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
//闰年判断
int n = Integer.valueOf(ss[0]);//将字符串形式转换为整型
if ((n % 400 == 0) || (n % 4 == 0 && n % 100 != 0))
date[2] = 29;
//
int y = Integer.valueOf(ss[1]);
int r = Integer.valueOf(ss[2]);
int sum = 0;//求和
for (int i = 1; i <= y; i++) {
if (i != y) {
sum += date[i];
} else {
sum += r;
}
}
System.out.println(sum);
sc.close();
}
}