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

当 输入 0 时候是 周几呀???????????

Posted by tzj115 at 2007-07-28 23:33:05 on Problem 2080
In Reply To:两个月了,没找出来错误。 Posted by:user at 2005-05-27 16:21:24
> main()
> {long a,a1,a2;
> long leap=0,b,c,d,e,f,i=0,j;
> long dd[10000];
> scanf("%ld",&dd[0]);
> while(dd[i]!=-1)
> {i++;
> scanf("%ld",&dd[i]);
> }
> for(i=0;dd[i]!=-1;i++)
> {dd[i]+=1;
> a=dd[i]/365;
> b=dd[i]%365;
> c=a/4;
> d=a/100;
> e=a/400;
> f=c-d+e;
> j=0;
> while(f>b)
> {j++;
> b+=365;
> }
> a-=j;
> b-=f;
> c=a%4;
> d=a%100;
> e=a%400;
> if((!c&&d)||!e)leap=1;
> if(b<=31){a1=1;a2=b;}
> else if(b<=59+leap){a1=2;a2=b-31;}
> else if(b<=90+leap){a1=3;a2=b-59-leap;}
> else if(b<=120+leap){a1=4;a2=b-90-leap;}
> else if(b<=151+leap){a1=5;a2=b-120-leap;}
> else if(b<=181+leap){a1=6;a2=b-151-leap;}
> else if(b<=212+leap){a1=7;a2=b-181-leap;}
> else if(b<=243+leap){a1=8;a2=b-212-leap;}
> else if(b<=273+leap){a1=9;a2=b-243-leap;}
> else if(b<=304+leap){a1=10;a2=b-273-leap;}
> else if(b<=334+leap){a1=11;a2=b-304-leap;}
> else {a1=12;a2=b-334-leap;}
> a+=2000;
> printf("%ld-",a);
> if(a1<10)printf("0%ld-",a1);
> else printf("%ld-",a1);
> if(a2<10)printf("0%ld ",a2);
> else printf("%ld ",a2);
> switch(dd[i]%7)
> {case 1 :printf("Saturday\n");break;
> case 2 :printf("Sunday\n");break;
> case 3 :printf("Monday\n");break;
> case 4 :printf("Tuesday\n");break;
> case 5 :printf("Wednesday\n");break;
> case 6 :printf("Thursday\n");break;
> case 0 :printf("Friday\n");break;
> }
> }
> }

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