Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

STL不用白不用,0ms

Posted by KatrineYang at 2016-11-07 01:20:49 on Problem 3751
#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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator