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 980616701 at 2009-07-04 00:18:51 on Problem 2080
#include<iostream>
using namespace std;
__int64 m=0;
char week_[7][10]={"Saturday","Sunday","Monday","Tuesday","Wednesday","Thursday","Friday"};
int main()
{
	while(1)
	{
		int k=0;
		int month=1,day=1;
		int year=2000,year1=365,year2=366;
		scanf("%I64d",&m);
		if(m==-1)break;
		int week=m%7;
		int kk=year2;
		while(m>kk)
		{
			if(year%4==0&&year%100!=0||year%400==0){m-=year2;year+=1;}
			else {m-=year1;year+=1;}
			if(year%4==0&&year%100!=0||year%400==0)kk=year1;else kk=year2;
		}
		if(year%4==0&&year%100!=0||year%400==0)
		{
			if(m<31){day+=m;}
			else if(m<60){month+=1;day+=m-31;}
			else if(m<91){month+=2;day+=m-60;}
			else if(m<121){month+=3;day+=m-91;}
			else if(m<152){month+=4;day+=m-121;}
			else if(m<182){month+=5;day+=m-152;}
			else if(m<213){month+=6;day+=m-182;}
			else if(m<244){month+=7;day+=m-213;}
			else if(m<274){month+=8;day+=m-244;}
			else if(m<305){month+=9;day+=m-274;}
			else if(m<335){month+=10;day+=m-305;}
			else if(m<366){month+=11;day+=m-335;}
		}
		else
		{
		    if(m<31){day+=m;}
			else if(m<59){month+=1;day+=m-31;}
			else if(m<90){month+=2;day+=m-60;}
			else if(m<210){month+=3;day+=m-91;}
			else if(m<=151){month+=4;day+=m-121;}
			else if(m<181){month+=5;day+=m-152;}
			else if(m<212){month+=6;day+=m-182;}
			else if(m<243){month+=7;day+=m-213;}
			else if(m<273){month+=8;day+=m-244;}
			else if(m<304){month+=10;day+=m-305;}
			else if(m<365){month+=11;day+=m-335;}
		}
		printf("%d-%02d-%02d %s\n",year,month,day,week_[week]);
		}
	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