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

读入数据可以这样写:scanf("%d/%d/%d-%d:%d:%d",&year,&month,&day,&hour,&minute,&second);

Posted by Xiao_Xiao_ at 2010-04-14 00:03:39 on Problem 3751
RT。
贴个code?
#include <iostream>
using namespace std;
int main()
{
	//freopen("in.txt","r",stdin);
	//freopen("out.txt","w",stdout);
	int i,N;
	int year,month,day,hour,minute,second;
	cin>>N;
	for(i=0;i<N;i++)
	{
		scanf("%d/%d/%d-%d:%d:%d",&year,&month,&day,&hour,&minute,&second);
		printf("%02d/%02d/%04d-",month,day,year);
		if(hour == 12)
			printf("12:%02d:%02dpm\n",minute,second);
		else if(hour == 0)
			printf("12:%02d:%02dam\n",minute,second);
		else if(hour > 12)
			printf("%02d:%02d:%02dpm\n",hour-12,minute,second);
		else
			printf("%02d:%02d:%02dam\n",hour,minute,second);
	}
	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