#include <iostream>
#include <cstdio>
using namespace std;
char week[7][10]={"Saturday","Sunday","Monday","Tuesday","Wednesday","Thursday","Friday"};
int flag(int a)
{
if(a%400==0||(a%4==0&&a%100!=0))
return 1;
else return 0;
}
int main()
{
int a;
int year[8000];
for(int i=2000;i<=9000;i++){
if(flag(i)==1)year[i-2000]=366;
else year[i-2000]=365;
}
int month[13]={0,31,0,31,30,31,30,31,31,30,31,30,31};
while(1){
cin>>a;
if(a==-1)break;
int b=a;
int Year=2000;
while(a>=year[Year-2000]){
a-=year[Year-2000];
Year++;
}
month[2]=28+flag(Year);
int Month=1;
while(a>=month[Month]){
a-=month[Month];
Month++;
}
int Day=1+a;
printf("%d-%02d-%02d %s\n",Year,Month,Day,week[b%7]);
}
return 0;
}
百炼 2964 日期问题
最新推荐文章于 2024-06-11 17:26:21 发布