poj3751 时间日期格式转换

来源:互联网 发布:蜂群算法 编辑:程序博客网 时间:2024/05/29 23:44

题目链接:http://poj.org/problem?id=3751
题意:中文题
解析:认真看清楚题目要求,很水的模拟,输入输出有点技巧

#include <iostream>#include <cstdio>#include <algorithm>#include <vector>#include <cstring>#include <queue>#include <cmath>#include <map>using namespace std;const int maxn = 1e6+100;const int inf = 0x7ffffff;int main(void){    int t;    cin>>t;    while(t--)    {        int yy,mm,dd,h,m,s;        scanf("%d/%d/%d-%d:%d:%d",&yy,&mm,&dd,&h,&m,&s);        printf("%02d/%02d/%04d-%02d:%02d:%02d",mm,dd,yy,(h+11)%12+1,m,s);        if(h>=12 && h<24)            puts("pm");        else            puts("am");    }    return 0;}
0 0
原创粉丝点击