|
#include <iostream>
#include <string>
using namespace std;
int main()
{
int a[12]={31,28,31,30,31,30,31,31,30,31,30,31};
int n;
int t,i,newyear;
string week[7]={"Monday","Tuesday","Wednesday","Thurday","Friday","Saturday","Sunday"};
while((cin>>n)&&n!=-1)
{ int year=2000;
while(n>365)
{ if(year%4==0 || (year%100!=0 && year%400==0))
t=n-366;
else
t=n-365;
year++;
}
newyear=2000+n/365;
cout<<newyear;
if(year%4==0 || (year%100!=0 && year%400!=0))
a[1]=29;
i=0;
while(t>30)
{
t=t-a[i];
i=i+1;
}
if((n%7)+6>7)
{
week[(n%7)+6]=week[(n%7)+6-7];
}
cout<<year<< "-" <<i<<t<<week[(n%7)+6-1]<<endl;
}
} |
|