poj3751

简单题

View Code
#include <iostream>
#include
<cstdio>
#include
<cstdlib>
#include
<cstring>
using namespace std;

int main()
{
//freopen("t.txt", "r", stdin);
int t;
scanf(
"%d", &t);
while (t--)
{
int year, month, day, hour, minute, second;
scanf(
"%d/%d/%d-%d:%d:%d", &year, &month, &day, &hour, &minute, &second);
printf(
"%02d/%02d/%04d-%02d:%02d:%02d%s\n", month, day, year, (hour - 1 + 12) % 12 + 1, minute, second, hour >= 12 ? "pm" : "am");
}
return 0;
}

posted @ 2011-07-10 18:00  金海峰  阅读(169)  评论(0编辑  收藏  举报