#include<stdio.h>
int calculate(int reg,int month,int day);
void main(){
int year;
int month;
int day;
int reg;
printf("input year: ");
scanf("%d",&year);
if(year<0) year=-year;
if(year%4==0&&year%100!=0) reg=0;
else if(year%100==0&&year%400!=0) reg=0;
else reg=1;
month: printf("input month: ");
scanf("%d",&month);
if(month<=0||month>12) {
printf("error input!\n");
goto month;
}
day:
printf("input day: ");
scanf("%d",&day);
if(calculate(reg,month,day)==0) goto day;
else printf("%d\n",calculate(reg,month,day));
}
int calculate(int reg,int month,int day){
int value=0;
int data1[12]={31,29,31,30,31,30,31,31,30,31,30,31};
int data2[12]={31,28,31,30,31,30,31,31,30,31,30,31};
int *a;
if(reg==0) a=data1;
else a=data2;
if(a[month-1]<day||day<=0) return 0;
else {
for(int i=1;i<month;i++) value=value+a[i-1];
value=value+day;
return value;
}
}