View Code of Problem 3310

#include<iostream>
#include<string>
#include<cstring>
#include<vector>
#include<iomanip>
#include<cstring>
#include<cstdio>
using namespace std;
typedef struct peo
{
	string name;
	int flag;//0未被选中
}peo;
peo a[65];
int main()
{	
	int n;
	scanf("%d", &n);
	while (n--)
	{
		char z;
		int year, mon, day, hour, time, second;
		scanf("%d/%d/%d-%d:%d:%d", &year, &mon, &day, &hour, &time, &second);
		if (hour == 12)
		{
			printf("%02d/%02d/%02d-%02d:%02d:%02dpm\n", mon, day, year, hour, time, second);
		}
		else if (hour == 0)
		{
			printf("%02d/%02d/%02d-%02d:%02d:%02dam\n", mon,day, year, hour+12, time, second);
		}
		else if (hour > 12)
		{
			printf("%02d/%02d/%02d-%02d:%02d:%02dpm\n", mon, day, year, hour-12, time, second);
		}
		else
		{
			printf("%02d/%02d/%02d-%02d:%02d:%02dam\n", mon, day, year, hour , time, second);
		}
	}
}

Double click to view unformatted code.


Back to problem 3310