View Code of Problem 3310

#include<iostream>
using namespace std;
int main(){
	int t;cin>>t;
	while(t--){
		int y,m,d,h,f,s,fl;
		char c;
		scanf("%d/%d/%d-%d:%d:%d",&y,&m,&d,&h,&f,&s);
		if(h<12)
			c='a';
		else
			c='p';
		if(h<13)
		fl=1;
		else
		fl=0;
		if(!fl)h-=12;
		if(h==0)
		h+=12;
		printf("%02d/%02d/%04d-%02d:%02d:%02d%cm\n",m,d,y,h,f,s,c);
	}
}

Double click to view unformatted code.


Back to problem 3310