易错点:
time先/1000
然后time/3600后,得到的结果为从1970年1月1日00:00:00 总共经过的小时
可能会大于24,因为有很多天
但题目值要求输出当天的小时,范围在0~24
所以h=time/3600%24
还好有第二个样例提示,如果只有第一个样例,会拿不到满分
#include <cstdio>
#include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;
typedef long long LL;
int main(){
LL time;
cin >> time;
time/=1000;
int h=time/3600%24, m=time%3600/60, s=time%60;
printf("%02d:%02d:%02d\n",h,m,s);
return 0;
}