试题 算法训练 天数计算
import java.util.Scanner;
public class count {
public static void main(String[] args) {
// TODO 自动生成的方法存根
//【统计生日天数】
Scanner sc=new Scanner(System.in);
int year = sc.nextInt();
int month = sc.nextInt();
int day = sc.nextInt();
sc.close();
int SumDays=0;
for(int i=1;i<month;i++) {
//31天的
if((i==1)||(i==3) || (i==5) || (i==7)||(i==8)|| (i==10) || (i==12)) {
SumDays+=31;
}else if(i==2) {
//判断闰年
if((year%4==0 && year%100!=0) || year%400==0) {
SumDays+=29;
}else {
SumDays+=28;
}
}else {
SumDays+=30; //30天的
}
}
System.out.print(SumDays+day);
}
}