#include<math.h>
#include<stdio.h>
int main(){
int a,b,c;
scanf("%d%d",&a,&b);
c=floor((b-a)/100.0+0.5);
printf("%02d:%02d:%02d",c/3600,c%3600/60,c%60);
return 0;
}
floor函数为取到不大于他的最大整数。这里四舍五入中的五入可以+0.5后再用floor函数解决。
#include<math.h>
#include<stdio.h>
int main(){
int a,b,c;
scanf("%d%d",&a,&b);
c=floor((b-a)/100.0+0.5);
printf("%02d:%02d:%02d",c/3600,c%3600/60,c%60);
return 0;
}