|
|
|
|
#include <stdio.h>
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
#include <string.h>
|
|
|
|
|
int yuefentianshu(int e,int a,int b)//e<><65><EFBFBD><EFBFBD> aΪ<61>·ݣ<C2B7>bΪ<62><CEAA><EFBFBD><EFBFBD>,
|
|
|
|
|
{ int p[12],i,c,sum;
|
|
|
|
|
c=a-1;
|
|
|
|
|
p[0]=31,p[1]=28,p[2]=31,p[3]=30,p[4]=31,p[5]=30,p[6]=31,p[7]=31,p[8]=30,p[9]=31,p[10]=30,p[11]=31;
|
|
|
|
|
sum=0;
|
|
|
|
|
for(i=0;i<c;i++)
|
|
|
|
|
{
|
|
|
|
|
sum=sum+p[i];
|
|
|
|
|
}
|
|
|
|
|
sum=sum+b;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
if((e%4==0&&e%100!=0||e%400==0)&&100*a+b>229)
|
|
|
|
|
{
|
|
|
|
|
sum++;
|
|
|
|
|
return sum;
|
|
|
|
|
}
|
|
|
|
|
return sum;
|
|
|
|
|
}
|
|
|
|
|
int main()
|
|
|
|
|
{ printf("Please input what you want to known which year or which month or which day:\n");
|
|
|
|
|
int p[12],w[50],a,b,c,d,e,f,g,h,j,k,i,i2,i3,i4,i5,i6,i7,i8,i9,i10,i11,i12,i13,l,m,n,q,a1,a2,a3,yushu,q1,x,y,z,zhongjianliang; //<2F><><EFBFBD><EFBFBD>a<EFBFBD><61><EFBFBD>·<EFBFBD>b<EFBFBD><62><EFBFBD><EFBFBD>c<EFBFBD><63><EFBFBD><EFBFBD><EFBFBD>˶<EFBFBD><CBB6><EFBFBD><EFBFBD><EFBFBD>d<EFBFBD><64><EFBFBD>·<EFBFBD><C2B7><EFBFBD><EFBFBD><EFBFBD>e
|
|
|
|
|
a=2019,b=1,c=11,q=0,j=0;
|
|
|
|
|
l=a,m=b,n=c;
|
|
|
|
|
i4=0;i5=0,i6=0,i7=0;
|
|
|
|
|
yushu=5;
|
|
|
|
|
p[0]=31,p[1]=28,p[2]=31,p[3]=30,p[4]=31,p[5]=30,p[6]=31,p[7]=31,p[8]=30,p[9]=31,p[10]=30,p[11]=31;
|
|
|
|
|
char str[15],d1[15],d2[15],d3[15];
|
|
|
|
|
gets(str);
|
|
|
|
|
for(i3=0;i3<=10;i3++)
|
|
|
|
|
{
|
|
|
|
|
if(str[i3]==32)
|
|
|
|
|
{
|
|
|
|
|
q++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(q==0)
|
|
|
|
|
{
|
|
|
|
|
a=1940,b=1,c=1;
|
|
|
|
|
while(str[i4]!=32)
|
|
|
|
|
{
|
|
|
|
|
i4++;
|
|
|
|
|
}
|
|
|
|
|
strncpy(d1,str+0,4);
|
|
|
|
|
a1=atoi(d1);
|
|
|
|
|
a2=1,a3=1;
|
|
|
|
|
printf(" ============================%d============================\n\n",a1);
|
|
|
|
|
|
|
|
|
|
for(i12=1;i12<=12;i12++)
|
|
|
|
|
{
|
|
|
|
|
a=1940,b=1,c=1;
|
|
|
|
|
l=1940,m=1,n=1;
|
|
|
|
|
x=a1,y=i12,z=a3;
|
|
|
|
|
i13=i12;
|
|
|
|
|
a1=l,i13=m,a3=n;
|
|
|
|
|
a=x,b=y,c=z;
|
|
|
|
|
e=yuefentianshu(a,b,c);//e<><65><EFBFBD>·<EFBFBD><C2B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
f=1;
|
|
|
|
|
g=365;
|
|
|
|
|
for(i2=a1+1;i2<=a-1;i2++)
|
|
|
|
|
{
|
|
|
|
|
if(i2%4==0&&i2%100!=0||i2%400==0)
|
|
|
|
|
{
|
|
|
|
|
j++;//<2F><><EFBFBD><EFBFBD>
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(a-a1==0)
|
|
|
|
|
{
|
|
|
|
|
k=e-f;
|
|
|
|
|
}
|
|
|
|
|
else if(a-a1==1)
|
|
|
|
|
{
|
|
|
|
|
k=e+g;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
k=e+g+j*366+(a-a1-1-j)*365;
|
|
|
|
|
}
|
|
|
|
|
q1=k%7;
|
|
|
|
|
if(q1==0)
|
|
|
|
|
{
|
|
|
|
|
i7=1;
|
|
|
|
|
}
|
|
|
|
|
else if(q1==1)
|
|
|
|
|
{
|
|
|
|
|
i7=2;
|
|
|
|
|
}
|
|
|
|
|
else if(q1==2)
|
|
|
|
|
{
|
|
|
|
|
i7=3;
|
|
|
|
|
}
|
|
|
|
|
else if(q1==3)
|
|
|
|
|
{
|
|
|
|
|
i7=4;
|
|
|
|
|
}
|
|
|
|
|
else if(q1==4)
|
|
|
|
|
{
|
|
|
|
|
i7=5;
|
|
|
|
|
}
|
|
|
|
|
else if(q1==5)
|
|
|
|
|
{
|
|
|
|
|
i7=6;
|
|
|
|
|
}
|
|
|
|
|
else if(q1==6)
|
|
|
|
|
{
|
|
|
|
|
i7=0;
|
|
|
|
|
}
|
|
|
|
|
if(y%4==0&&y%100!=0||y%400==0)
|
|
|
|
|
{
|
|
|
|
|
p[1]=29;
|
|
|
|
|
}
|
|
|
|
|
for(i8=1;i8<=p[y-1];i8++)
|
|
|
|
|
{
|
|
|
|
|
i9=i7+i8-1;
|
|
|
|
|
w[i9]=i8;
|
|
|
|
|
}
|
|
|
|
|
for(i10=0;i10<=42;i10++)
|
|
|
|
|
{
|
|
|
|
|
if(i10<i7||i10>i9)
|
|
|
|
|
{
|
|
|
|
|
w[i10]=0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
printf(" ===========%d<><64>============\n",y);
|
|
|
|
|
printf(" SUN MON TUE WED THU FRI SAT\n ",y);
|
|
|
|
|
printf(" ");
|
|
|
|
|
for(i10=0;i10<=6;i10++)
|
|
|
|
|
{
|
|
|
|
|
if(w[i10]!=0)
|
|
|
|
|
{
|
|
|
|
|
printf(" %3d",w[i10]);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
printf(" ");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
printf("\n");
|
|
|
|
|
printf(" ");
|
|
|
|
|
for(i10=7;i10<=13;i10++)
|
|
|
|
|
{
|
|
|
|
|
if(w[i10]!=0)
|
|
|
|
|
{
|
|
|
|
|
printf(" %3d",w[i10]);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
printf(" ");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
printf("\n");
|
|
|
|
|
printf(" ");
|
|
|
|
|
for(i10=14;i10<=20;i10++)
|
|
|
|
|
{
|
|
|
|
|
if(w[i10]!=0)
|
|
|
|
|
{
|
|
|
|
|
printf(" %3d",w[i10]);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
printf(" ");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
printf("\n");
|
|
|
|
|
printf(" ");
|
|
|
|
|
for(i10=21;i10<=27;i10++)
|
|
|
|
|
{
|
|
|
|
|
if(w[i10]!=0)
|
|
|
|
|
{
|
|
|
|
|
printf(" %3d",w[i10]);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
printf(" ");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
printf("\n");
|
|
|
|
|
printf(" ");
|
|
|
|
|
for(i10=28;i10<=34;i10++)
|
|
|
|
|
{
|
|
|
|
|
if(w[i10]!=0)
|
|
|
|
|
{
|
|
|
|
|
printf(" %3d",w[i10]);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
printf(" ");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
printf("\n");
|
|
|
|
|
printf(" ");
|
|
|
|
|
for(i10=35;i10<=41;i10++)
|
|
|
|
|
{
|
|
|
|
|
if(w[i10]!=0)
|
|
|
|
|
{
|
|
|
|
|
printf(" %3d",w[i10]);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
printf(" ");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
printf("\n");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(q==1)
|
|
|
|
|
{ a=1940,b=1,c=1;
|
|
|
|
|
l=1940,m=1,n=1;
|
|
|
|
|
while(str[i4]!=32)
|
|
|
|
|
{
|
|
|
|
|
i4++;
|
|
|
|
|
}
|
|
|
|
|
strncpy(d1,str+0,4);
|
|
|
|
|
a1=atoi(d1);
|
|
|
|
|
i5=i4+1;
|
|
|
|
|
while(str[i4+1]!=0)
|
|
|
|
|
{
|
|
|
|
|
i4++;
|
|
|
|
|
}
|
|
|
|
|
strncpy(d2,str+i5,i4+1-i5);
|
|
|
|
|
a2=atoi(d2);
|
|
|
|
|
a3=1;
|
|
|
|
|
x=a1,y=a2,z=a3;
|
|
|
|
|
a1=l,a2=m,a3=n;
|
|
|
|
|
a=x,b=y,c=z;
|
|
|
|
|
e=yuefentianshu(a,b,c);//e<><65><EFBFBD>·<EFBFBD><C2B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
f=1;
|
|
|
|
|
g=365;
|
|
|
|
|
for(i2=a1+1;i2<=a-1;i2++)
|
|
|
|
|
{
|
|
|
|
|
if(i2%4==0&&i2%100!=0||i2%400==0)
|
|
|
|
|
{
|
|
|
|
|
j++;//<2F><><EFBFBD><EFBFBD>
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(a-a1==0)
|
|
|
|
|
{
|
|
|
|
|
k=e-f;
|
|
|
|
|
}
|
|
|
|
|
else if(a-a1==1)
|
|
|
|
|
{
|
|
|
|
|
k=e+g;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
k=e+g+j*366+(a-a1-1-j)*365;
|
|
|
|
|
}
|
|
|
|
|
q1=k%7;
|
|
|
|
|
if(q1==0)
|
|
|
|
|
{
|
|
|
|
|
i7=1;
|
|
|
|
|
}
|
|
|
|
|
else if(q1==1)
|
|
|
|
|
{
|
|
|
|
|
i7=2;
|
|
|
|
|
}
|
|
|
|
|
else if(q1==2)
|
|
|
|
|
{
|
|
|
|
|
i7=3;
|
|
|
|
|
}
|
|
|
|
|
else if(q1==3)
|
|
|
|
|
{
|
|
|
|
|
i7=4;
|
|
|
|
|
}
|
|
|
|
|
else if(q1==4)
|
|
|
|
|
{
|
|
|
|
|
i7=5;
|
|
|
|
|
}
|
|
|
|
|
else if(q1==5)
|
|
|
|
|
{
|
|
|
|
|
i7=6;
|
|
|
|
|
}
|
|
|
|
|
else if(q1==6)
|
|
|
|
|
{
|
|
|
|
|
i7=0;
|
|
|
|
|
}
|
|
|
|
|
if(y%4==0&&y%100!=0||y%400==0)
|
|
|
|
|
{
|
|
|
|
|
p[1]=29;
|
|
|
|
|
}
|
|
|
|
|
for(i8=1;i8<=p[y-1];i8++)
|
|
|
|
|
{
|
|
|
|
|
i9=i7+i8-1;
|
|
|
|
|
w[i9]=i8;
|
|
|
|
|
}
|
|
|
|
|
for(i10=0;i10<=42;i10++)
|
|
|
|
|
{
|
|
|
|
|
if(i10<i7||i10>i9)
|
|
|
|
|
{
|
|
|
|
|
w[i10]=0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
printf(" ============%d<><64>============\n",y);
|
|
|
|
|
printf(" SUN MON TUE WED THU FRI SAT\n ",y);
|
|
|
|
|
printf(" ");
|
|
|
|
|
for(i10=0;i10<=6;i10++)
|
|
|
|
|
{
|
|
|
|
|
if(w[i10]!=0)
|
|
|
|
|
{
|
|
|
|
|
printf(" %3d",w[i10]);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
printf(" ");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
printf("\n");
|
|
|
|
|
printf(" ");
|
|
|
|
|
for(i10=7;i10<=13;i10++)
|
|
|
|
|
{
|
|
|
|
|
if(w[i10]!=0)
|
|
|
|
|
{
|
|
|
|
|
printf(" %3d",w[i10]);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
printf(" ");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
printf("\n");
|
|
|
|
|
printf(" ");
|
|
|
|
|
for(i10=14;i10<=20;i10++)
|
|
|
|
|
{
|
|
|
|
|
if(w[i10]!=0)
|
|
|
|
|
{
|
|
|
|
|
printf(" %3d",w[i10]);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
printf(" ");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
printf("\n");
|
|
|
|
|
printf(" ");
|
|
|
|
|
for(i10=21;i10<=27;i10++)
|
|
|
|
|
{
|
|
|
|
|
if(w[i10]!=0)
|
|
|
|
|
{
|
|
|
|
|
printf(" %3d",w[i10]);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
printf(" ");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
printf("\n");
|
|
|
|
|
printf(" ");
|
|
|
|
|
for(i10=28;i10<=34;i10++)
|
|
|
|
|
{
|
|
|
|
|
if(w[i10]!=0)
|
|
|
|
|
{
|
|
|
|
|
printf(" %3d",w[i10]);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
printf(" ");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
printf("\n");
|
|
|
|
|
printf(" ");
|
|
|
|
|
for(i10=35;i10<=41;i10++)
|
|
|
|
|
{
|
|
|
|
|
if(w[i10]!=0)
|
|
|
|
|
{
|
|
|
|
|
printf(" %3d",w[i10]);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
printf(" ");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
printf("\n");
|
|
|
|
|
}
|
|
|
|
|
if(q==2)
|
|
|
|
|
{
|
|
|
|
|
while(str[i4]!=32)
|
|
|
|
|
{
|
|
|
|
|
i4++;
|
|
|
|
|
}
|
|
|
|
|
strncpy(d1,str+0,4);
|
|
|
|
|
a1=atoi(d1);
|
|
|
|
|
i5=i4+1;
|
|
|
|
|
while(str[i4+1]!=32)
|
|
|
|
|
{
|
|
|
|
|
i4++;
|
|
|
|
|
}
|
|
|
|
|
strncpy(d2,str+i5,i4+1-i5);
|
|
|
|
|
a2=atoi(d2);
|
|
|
|
|
i6=i4+2;
|
|
|
|
|
while(str[i4+2]!=0)
|
|
|
|
|
{
|
|
|
|
|
i4++;
|
|
|
|
|
}
|
|
|
|
|
strncpy(d3,str+i6,i4+2-i6);
|
|
|
|
|
a3=atoi(d3);
|
|
|
|
|
x=a1,y=a2,z=a3;
|
|
|
|
|
if(a<a1)
|
|
|
|
|
{
|
|
|
|
|
zhongjianliang=a;
|
|
|
|
|
a=a1;
|
|
|
|
|
a1=zhongjianliang;
|
|
|
|
|
zhongjianliang=b;
|
|
|
|
|
b=a2;
|
|
|
|
|
a2=zhongjianliang;
|
|
|
|
|
zhongjianliang=c;
|
|
|
|
|
c=a3;
|
|
|
|
|
a3=zhongjianliang;
|
|
|
|
|
}
|
|
|
|
|
else if(a==a1)
|
|
|
|
|
{
|
|
|
|
|
if(b<a2)
|
|
|
|
|
{
|
|
|
|
|
zhongjianliang=b;
|
|
|
|
|
b=a2;
|
|
|
|
|
a2=zhongjianliang;//
|
|
|
|
|
zhongjianliang=c;
|
|
|
|
|
c=a3;
|
|
|
|
|
a3=zhongjianliang;
|
|
|
|
|
}
|
|
|
|
|
else if(b==a2)
|
|
|
|
|
{
|
|
|
|
|
if(c<a3)
|
|
|
|
|
{
|
|
|
|
|
zhongjianliang=c;
|
|
|
|
|
c=a3;
|
|
|
|
|
a3=zhongjianliang;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
e=yuefentianshu(a,b,c);//e<><65><EFBFBD>·<EFBFBD><C2B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
f=yuefentianshu(a1,a2,a3);//fС<66>·<EFBFBD><C2B7><EFBFBD><EFBFBD><EFBFBD> <20><>ǰ<EFBFBD>棩
|
|
|
|
|
if(a1%4==0&&a1%100!=0||a1%400==0)
|
|
|
|
|
{
|
|
|
|
|
g=366-f;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
g=365-f;
|
|
|
|
|
}
|
|
|
|
|
for(i2=a1+1;i2<=a-1;i2++)
|
|
|
|
|
{
|
|
|
|
|
if(i2%4==0&&i2%100!=0||i2%400==0)
|
|
|
|
|
{
|
|
|
|
|
j++;//<2F><><EFBFBD><EFBFBD>
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(a-a1==0)
|
|
|
|
|
{
|
|
|
|
|
k=e-f;
|
|
|
|
|
}
|
|
|
|
|
else if(a-a1==1)
|
|
|
|
|
{
|
|
|
|
|
k=e+g;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
k=e+g+j*366+(a-a1-1-j)*365;
|
|
|
|
|
}
|
|
|
|
|
if(l>x||l==x&&m>y||l==x&&m==y&&n>z)
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>%d<><64>",k);
|
|
|
|
|
}
|
|
|
|
|
else if(l==x&&m==y&&n==z)
|
|
|
|
|
|