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

这都会wa!!没天理了!

Posted by ferrettemp at 2005-03-16 09:09:25 on Problem 2210
#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:
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