#include <cstdio> #include <iostream> #include <string> #include <cstring> #include <sstream> using namespace std; //题目有毒,不是gc++编译的 to_string stoi都用不了 int main(){ int t; cin>>t; for(int i=0;i<t;i++){ int yy,mm,dd,hh,ii,ss; scanf("%d/%d/%d-%d:%d:%d",&yy,&mm,&dd,&hh,&ii,&ss); printf("%02d/%02d/%d-",mm,dd,yy); bool am=true; if(hh>=12){ am=false; } if(hh==0||hh==12){ hh=12; } else{ hh=hh%12; } printf("%02d:%02d:%02d",hh,ii,ss); printf(am?"am\n":"pm\n"); } return 0; } |
Double click to view unformatted code.