Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

那为牛人帮忙看看代码有什么错,我都WA 的苦闷了!

Posted by kissacm at 2006-07-23 18:50:25 on Problem 2080
#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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator