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

## Re:惭愧啊。11次WA。。我活不下去了。。贡献数据>>上面的数据我都测试正确了，为什么还是不AC？附代码？

Posted by 3902100816 at 2011-07-20 11:20:39 on Problem 2080
In Reply To:惭愧啊。11次WA。。我活不下去了。。贡献数据 Posted by:userfriendly at 2008-08-02 21:46:12
```/*> 关键数据：
>   闰年、闰年前后一年的 元旦，2月28、29？日， 3月1日， 12月31日。
>   特殊闰年和普通闰年要特别注意： 2000及前后、 2004及前后、 2400及前后， 月日同上。
>   特殊平年和特殊平年前后一年：2099、2100、2101， 月日同上。
>
> 输入    输出
> 59 2000-02-29 Tuesday
> 60 2000-03-01 Wednesday
> 365 2000-12-31 Sunday
> 366 2001-01-01 Monday
>
> 1460 2003-12-31 Wednesday
> 1461 2004-01-01 Thursday
> 1520 2004-02-29 Sunday
> 1521 2004-03-01 Monday
> 1826 2004-12-31 Friday
> 1827 2005-01-01 Saturday
>
> 36524 2099-12-31 Thursday
> 36525 2100-01-01 Friday
> 36583 2100-02-28 Sunday
> 36584 2100-03-01 Monday
> 36889 2100-12-31 Friday
> 36890 2101-01-01 Saturday
>
> 146096 2399-12-31 Friday
> 146097 2400-01-01 Saturday
> 146156 2400-02-29 Tuesday
> 146157 2400-03-01 Wednesday
*/
#include<iostream>
#include<string>
using namespace std;
string week[7]={"Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"};
int month[]={0,31,59,90,120,151,181,212,243,273,304,334,365};
int main()
{
long long num;
cin>>num;
while(num!=-1)
{
int Y,M,D,i;
string w=week[(num-1)%7];
long long sum=0;
for(Y=2000;Y<=9999;Y++)
{
bool p=0;
if((Y%100!=0 && Y%4==0) || (Y%100==0 && Y%400==0))
{sum+=366;}
else
{sum+=365;}
if(sum>num)
{
if((Y%100!=0 && Y%4==0) || (Y%100==0 && Y%400==0))
{sum-=366;p=1;}
else
{sum-=365;p=1;}
}
if(p)break;
}
sum=num-sum;
for(i=1;i<=12;i++)
{
bool p=0;
if((Y%100!=0 && Y%4==0) || Y%400==0)
{
if((i>=2&&sum<=(month[i]+1))||(i==1 && sum<=month[1]))
{
M=i;
if(i<=2)
D=sum+1-month[i-1];
else
D=sum-month[i-1];
p=1;
}
}
else
{
if(sum<=month[i])
{
M=i;
D=sum-month[i-1]+1;
p=1;
}
}
if(p)break;
}
if(((Y%100!=0 && Y%4==0) || Y%400==0)&&M==2&&D==30)
{M=3;D=1;}
if(((Y%100==0 && Y%400!=0) || Y%4!=0)&&M==2&&D==29)
{M=3;D=1;}
if(M>=10)
{
if(D>=10)cout<<Y<<'-'<<M<<'-'<<D<<' '<<w<<endl;
else cout<<Y<<'-'<<M<<"-0"<<D<<' '<<w<<endl;
}
else
{
if(D>=10)cout<<Y<<"-0"<<M<<'-'<<D<<' '<<w<<endl;
else cout<<Y<<"-0"<<M<<"-0"<<D<<' '<<w<<endl;
}
cin>>num;
}
return 0;
}```

Followed by: