1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
#include <cstdio> #include <iostream> #include <cstring> #include <string> using namespace std; void printTime(int tyme) { if(tyme<10) { printf("0%d\n",tyme); } else { printf("%d\n",tyme); } } int main() { int t,hour,min; scanf("%d",&t); char s[10]; int highest = 12*60; int lowest = 0; int mirror; while(t--) { scanf("%s",s); hour = (s[0]-'0')*10; hour += (s[1]-'0'); hour%=12; min = (s[3]-'0')*10; min += (s[4]-'0'); min = hour*60+min; mirror = highest-min; hour = mirror/60; min = mirror%60; if(hour==0) { printf("12:"); printTime(min); } else if(hour<10) { printf("0%d:",hour); printTime(min); } else { printf("%d:",hour); printTime(min); } } return 0; } |