标签:
Time Limit: 300/100 MS (Java/Others) Memory Limit: 65535/32768 K (Java/Others)
Total Submission(s): 3757 Accepted Submission(s): 1613
#include <stdio.h> #include <string.h> using namespace std; typedef long long LL; int main(){ int tcase; int HH,MM,SS,hh,mm,ss; scanf("%d",&tcase); while(tcase--){ scanf("%d:%d:%d %d:%d:%d",&HH,&MM,&SS,&hh,&mm,&ss); hh%=12; bool flag = false,flag1 = false; SS-=ss; if(SS<0) SS+=60,flag = true; MM-=mm; if(flag){ MM-=1; } if(MM<0) { MM+=60; flag1= true; } HH-=hh; if(flag1){ HH-=1; } if(HH<0) HH+=12; printf("%02d:%02d:%02d\n",HH,MM,SS); } }
标签:
原文地址:http://www.cnblogs.com/liyinggang/p/5598645.html