Description
给定一个以秒为单位的时间t,要求用“< H> :< M> :< S> ”的格式来表示这个时间。< H> 表示时间,< M> 表示分钟,而< S> 表示秒,它们都是整数且没有前导的“0”。例如,若t=0,则应输出是“0:0:0”;若t=3661,则输出“1:1:1”。
Input
输入只有一行,是一个整数t(0< =t< =86399)。
Output
输出只有一行,是以“< H> :< M> :< S> ”的格式所表示的时间,不包括引号。
Sample Input
样例输入1 0
样例输入2 5436
Sample Output
样例输出1 0:0:0
样例输出2 1:30:36
#include <cstdio>
#include <iostream>
#include <cmath>
#include <cstring>
#include <
string>
#include <algorithm>
using namespace std;
int main()
{
int h, m, s, n, miao;
scanf("%d", &
n);
if(n ==
0)printf(
"0:0:0\n");
else
{
miao = n/
60;
h = miao/
60;
m = miao%
60;
s = n%
60;
printf("%d:%d:%d\n", h, m, s);
}
return 0;
}
转载于:https://www.cnblogs.com/RootVount/p/10386432.html
相关资源:JAVA上百实例源码以及开源项目