#include
#include
#include
struct ymd {
int Y,M,D;
};
const short MonthDay[]={0,31,28,31,30,31,30,31,31,30,31,30,31};
int YMD_2_JD(int Y, int M, int D){
const short MonthDay[]={0,31,28,31,30,31,30,31,31,30,31,30,31};
int JD,i;
JD=D;
for (i=0;i
return JD;
}
void main()
{
int d,k;
struct ymd a;
printf("input Year Month day\n");
k = scanf("%4d %2d %2d",&a.Y,&a.M,&a.D);
if (k != 3) {printf("input err\n"); exit(0);};
if (a.M < 1 || a.M > 12) {printf("err Month\n"); exit(0); };
if ( (a.M==2) && (a.D==29) ) {
if ( (a.Y%4==0)&&(a.Y%100!=0)||(a.Y%400==0)) {goto Lab;} else {printf("err Day\n"); exit(0); };
}
if (a.D < 1 || a.D > MonthDay[a.M]) {printf("err Day\n"); exit(0); };
Lab:;
if (a.Y < 0) {printf("negtive year\n"); exit(0);};
d=YMD_2_JD(a.Y,a.M,a.D);
printf("%d",d);
exit(0);
}