poj 3751 时间日期格式转换

//对c语言中的输入和输出熟悉的情况之下就很快可以解决问题了! 
#include <iostream>
#include <string>
#include <cstdio>
using namespace std;

int main()
{
    int tc, year, day, month,  hour, min, sec;
    scanf("%d", &tc);
    while (tc--){
          scanf("%d/%d/%d-%d:%d:%d", &year, &month, &day, &hour, &min, &sec);
          int newhour = (hour + 11) % 12 + 1;
          printf("%02d/%02d/%d-%02d:%02d:%02d%s\n", month, day, year, newhour, min, sec, hour < 12 ? "am" : "pm");
    }
    
    system("pause");
}

你可能感兴趣的:(c,System,语言)