View Code of Problem 3310

#include<iostream>
#include<string>
#include<cstdio>
using namespace std;
int main() {
	int T; cin >> T;
	while (T--) {
		int n,y,r,h,m,s;
		scanf("%d/%d/%d-%d:%d:%d", &n, &y, &r,&h,&m,&s);
		string str("am");
		if (h >= 12)str = "pm";
		h %= 12;
		if (h == 0)h = 12;
		printf("%.2d/%.2d/%d-%.2d:%.2d:%.2d", y, r, n, h, m, s);
		cout << str << endl;
	}
}

Double click to view unformatted code.


Back to problem 3310