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

谁帮我看看 怎么就CE了

Posted by huhuhuhh at 2010-03-02 22:09:40 on Problem 3751
#include<iostream>
#include<stdlib.h>
#include<string.h>
using namespace std;
int main()
{
	int t,i,j,h,mi,s;
	char y[10],m[10],d[10],hour[10],min[10],sec[10];
	while(1==scanf("%d",&t)){
		getchar();
		for(i=0;i<t;i++){
			cin.getline(y,sizeof(y),'/');
			cin.getline(m,sizeof(m),'/');
			cin.getline(d,sizeof(d),'-');
			cin.getline(hour,sizeof(hour),':');
			cin.getline(min,sizeof(min),':');
			cin.getline(sec,sizeof(sec));
			cout<<m<<'/'<<d<<'/'<<y<<'-';
			s=atoi(hour);mi=atoi(min);s=atoi(sec);
			if(h==0)
				printf("%d:%s:%sam\n",12,min,sec);
			else if(h<12)
				printf("%s:%s:%sam\n",hour,min,sec);
			else if(h==12&&mi==0&&s==0)
				printf("%s:%s:%spm\n",hour,min,sec);
			else if(h==12)
				printf("%d:%s:%spm\n",12,min,sec);
			else if(h>12)
				printf("%s:%s:%spm\n",h-12,min,sec);
		}

	}
		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