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 ;
}

你可能感兴趣的:(poj)