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

W取模后可能是负数啊,这个你没处理。

Posted by winsweet at 2008-08-28 07:26:43 on Problem 3047
In Reply To:Still WA Posted by:betaver at 2006-10-22 12:23:44
> //PKKU3047 Bovine Birthday
> #include <stdio.h>
> #include <stdlib.h>
> 
> int y,m,d,w,c,a;
> char *weekday[]={"sunday","monday","tuesday","wednesday","thursday","friday","saturday"};
> 
> int main()
> {
>     while (scanf("%d%d%d",&y,&m,&d)!=EOF){
>     a=(14-m)/12;
>     y=y-a;
>     m=m+12*a-2;
>     c=y/100;
>     y=y%100;
>     w=(c/4-2*c+y+y/4+((13*m-1)/5)+d)%7;
>     printf("%s\n",weekday[w]);
>     }
> }

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