这题一开始我是在最后使原数加上0.5,再四舍五入就行了,但结果没全过。后来考虑在一开始就四舍五入,防止精度缺失。ac了!
#include<iostream>
using namespace std;
int main()
{
int a,b;
cin>>a>>b;
int times=(b-a)*1.0/100+0.5;
int h,m, s;
h=times/3600;
times-=h*3600;
m=times/60;
times-=m*60;
s=times;
s+=0.5;
printf("%02d:%02d:%02d\n",h,m,s);
return 0;
}