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

调用标准库<time.h>函数,为什么还是WA?不解!

Posted by nanhuacrab at 2007-10-07 13:04:06 on Problem 2080
#include <time.h>
#include <stdio.h>

#define SECONDS 3600 * 24

int main( ) {

	int n;
	time_t t;
	struct tm *newTime;
	char buff[80];

	t = ( 365 * 30 + 7 ) * SECONDS;

	while ( scanf( "%d", &n ) && n != -1 ) {
		t += n * SECONDS;
		//newTime = localtime( &t );
		newTime = gmtime( &t );
		t -= n * SECONDS;	
		strftime( buff, 80, "%Y-%m-%d %A", newTime );
		puts( buff );
	}

	return 0;
}

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