| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
那为牛人帮忙看看代码有什么错,我都WA 的苦闷了!#include<fstream>
#include<algorithm>
#include<string>
#include<cmath>
#include<memory>
using namespace std;
ifstream cin("in.txt");
ofstream cout("out.txt");
int year[4]={366,365,365,365};
int month[12]={31,28,31,30,31,30,31,31,30,31,30,31};
string menu[7]={"Saturday","Sunday","Mondey","Tuesday","Wednesday","Thursday","Friday"};
int main()
{
long int m,n,nmyear,nmmon,nmday,i;
while(cin>>m&&m!=-1)
{
nmyear=2000;nmmon=0;nmday=0;
n=m;
while(true)
{
for(i=0;i<=3;i++)
if(n>=year[i]){nmyear++;n-=year[i];}
else break;
//if(n<year[0]) break;
if(i<=3) break;
}
if(nmyear%400==0) month[1]=29;
else if(nmyear%4==0){
if(nmyear%100==0) month[1]=28;
else month[1]=29;
}
for(i=0;i<12;i++)
if(n>=month[i]) {nmmon++;n-=month[i];}
else break;
nmday=n;
cout<<nmyear<<'-';
if(nmmon+1<10) cout<<'0'<<nmmon+1<<'-';
else cout<<nmmon+1<<'-';
if(nmday+1<10) cout<<'0'<<nmday+1<<' ';
else cout<<nmday+1<<' ';
cout<<menu[m%7+1-1]<<endl;
}
return 0;
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator