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<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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator