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 |
很短的AC代碼(相信可以去除struct令到更短)#include <cstdio> using namespace std; struct Date { int Y, M, D, h, m, s; bool read() { return scanf("%d/%d/%d-%d:%d:%d\n", &Y, &M, &D, &h, &m, &s) == 6; } void write() { printf("%02d/%02d/%02d-%02d:%02d:%02d%s\n", M, D, Y, (h + 11) % 12 + 1, m, s, h < 12 ? "am" : "pm"); } }; int main() { int t; scanf("%d", &t); while (t--) { Date date; date.read(); date.write(); } return 0; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator