1026 程序运行时间 (15 分)
题目链接
https://pintia.cn/problem-sets/994805260223102976/problems/994805295203598336
输入样例:
123 4577973
输出样例:
12:42:59
题解
四舍五入函数:round()
取时取分取秒:h=x/3600,m=x%3600/60,s=x%60
#include <bits/stdc++.h>
using namespace std;
int main()
{
int c1,c2;
scanf("%d%d",&c1,&c2);
int x=round((c2-c1)/100.0);
//printf("%d\n",x);
int h=x/3600,m=x%3600/60,s=x%60;
printf("%.2d:%.2d:%.2d\n",h,m,s);
return 0;
}