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 |
Re:到底哪错了?我的WA啊……In Reply To:到底哪错了?我的WA啊…… Posted by:cpp0600548275 at 2006-03-05 23:24:10 > #include<stdio.h> > > int days(int,int,int,int=1,int=1,int=2000); > const int mon[12]={31,28,31,30,31,30,31,31,30,31,30,31}, > leapmon[12]={31,29,31,30,31,30,31,31,30,31,30,31}; > > void main() > { > int number,i,claYear,claMonth,claDay,claHour,claMinute,claSecond,meDay,meMonth,meYear,meHour,meMinute,meSecond; > double day,conv; > char a[9],b[12]; > scanf("%d",&number); > for(i=0;i<number;i++) > { > scanf("%s%s",a,b); > sscanf(a,"%d:%d:%d",&claHour,&claMinute,&claSecond); > sscanf(b,"%d.%d.%d",&claDay,&claMonth,&claYear); > day=days(claDay,claMonth,claYear); > day+=claHour/24.0+claMinute/1440.0+claSecond/86400.0; > meDay=day; > conv=10*(day-m); > meHour=conv; > conv=100*(conv-meHour); > meMinute=conv; > meSecond=100*(conv-meMinute); > meMonth=meDay/100; > meDay%=100; > meYear=meMonth/10; > meMonth%=10; > meDay++; > meMonth++; > printf("%d:%d:%d %d.%d.%d\n",meHour,meMinute,meSecond,meDay,meMonth,meYear); > } > } > > int days(int day2,int month2,int year2,int day1,int month1,int year1) > { > int day,i; > day=(year2-year1)*365; > day+=(year2-year1)/4; > for(i=year1;i<year1+(year2-year1)%4;i++) > if(i%4==0) > day++; > day-=(year2-1)/100-(year1-1)/100; > day+=(year2-1)/400-(year1-1)/400; > if(year2%4==0 && (year2%400==0 || year2%100!=0)) > for(i=0;i<(month2-1);i++) > day+=leapmon[i]; > else > for(i=0;i<(month2-1);i++) > day+=mon[i]; > if(year1%4==0 && (year1%400==0 || year1%100!=0)) > for(i=0;i<(month1-1);i++) > day-=leapmon[i]; > else > for(i=0;i<(month1-1);i++) > day-=mon[i]; > day+=day2-day1; > return day; > } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator