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

## 附上效率优化过的, 应该没有比这效率高的了吧

Posted by wm3418925 at 2016-09-07 22:05:47 on Problem 3751
```#include <stdio.h>
int main() {
int t;
unsigned int s, r;
short h;
char ch;

((char *)r) = '/';
((char *)r) = '/';
((char *)r) = '-';
((char *)r) = ':';
((char *)r) = 'm';
((char *)r) = '\0';//其实20和21可以合并为一个short, 减少一次赋值

scanf("%d",&t);
for (--t; t>=0; --t) {
scanf("%s", ((char *)s));

h = (((char *)s) - '0')*10 + (((char *)s) - '0');

if (h >= 12) {ch = 'p';h-=12;}
else ch = 'a';

if (h == 0) h = 12;

((char *)r) = ((char *)s);
((char *)r) = ((char *)s);

((char *)r) = ((char *)s);
((char *)r) = ((char *)s);

((unsigned short *)r) = *((unsigned short *)s);
((unsigned short *)r) = ((unsigned short *)s);

((char *)r) = (h/10)+'0';
((char *)r) = (h%10)+'0';

((unsigned short *)r) = ((unsigned short *)s);
((unsigned short *)r) = ((unsigned short *)s);
((char *)r) = ((char *)s);
((char *)r) = ch;

puts((char *)r);
}

return 0;
}```

Followed by: Home Page Go Back To top