| ||||||||||
| 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 <stdio.h>
void main()
{
int moban[2][13]={{0,31,28,31,30,31,30,31,31,30,31,30,31},{0,31,29,31,30,31,30,31,31,30,31,30,31}};
int year,month,day,hour,minute,second;
int nian,yue,ri,xiaoshi,fen,miao,temp;
int k,t,runnian;
double totle;
scanf("%d",&t);
while (t--)
{
temp=0;
scanf("%d:%d:%d %d.%d.%d",&hour,&minute,&second,&day,&month,&year);
if (year>2000)
temp=(year-2001)/4+(year-2001)/400-(year-2001)/100+1;
totle=(year-2000)*365+temp;
if (year%400==0||year%100!=0&&year%4==0)
runnian=1;
else runnian=0;
for (k=1;k<month;k++)
totle+=moban[runnian][k];
totle+=day-1;
nian=totle/1000;
totle-=nian*1000;
totle*=86400;
totle+=hour*3600+minute*60+second;
yue=1+totle/8640000;
totle-=(yue-1)*8640000;
ri=1+totle/86400;
totle-=(ri-1)*86400;
xiaoshi=totle/8640;
totle-=xiaoshi*8640;
fen=totle/86.4;
miao=totle/0.864-fen*100;
printf("%d:%d:%d %d.%d.%d\n",xiaoshi,fen,miao,ri,yue,nian);
}
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator