| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
STL不用白不用,0ms#include <iostream>
#include <string>
#include <cstdlib>
using namespace std;
int main() {
int n;
cin >> n;
while(n--){
string s;
cin >> s;
string nian = s.substr(0,4), yue = s.substr(5,2), ri = s.substr(8,2);
int shi = atoi(s.substr(11,2).c_str());
string fm = s.substr(13);
cout << yue << "/" << ri << "/" << nian << "-";
int ss = (shi+11)%12+1;
if(ss<10) cout << 0;
cout << ss << fm;
if(shi>=12) cout << "pm";
else cout << "am";
cout << endl;
}
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator