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 cherry_89 at 2008-05-26 20:54:46 on Problem 2080
#include<iostream>
using namespace std;
char week[7][10]={"Saturday","Sunday","Monday","Tuesday","Wednesday","Thursday","Friday"};
int year[2]={365,366};
int month[2][12]={31,28,31,30,31,30,31,31,30,31,30,31,31,29,31,30,31,30,31,31,30,31,30,31};

int type(int m)
{
	if((m%4==0&&m%100!=0)||(m%400==0))
       return 1;
    else 
       return 0;
}
int main()
{
    int days,dayofweek;
    int i=0,j=0;
    while(cin>>days&&days!=-1)
    {
        dayofweek=days%7;
        for(i=2000;days>=year[type(i)];i++)
            days-=year[type(i)];
        for(j=0;days>=month[type(i)][j];j++)
            days-=month[type(i)][j];
      cout<<i<<"-"<<j+1<<"-"<<days+1<<" "<<week[dayofweek]<<endl;

    }
	system("pause");
	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