题目:http://lx.lanqiao.cn/problem.page?gpid=T2911
解题思路:
把剩余那天的时分秒取出来格式化输出即可。
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
long hm = sc.nextLong();
long miao = hm / 1000;
//一天86400秒
long oneday = 86400;
//剩余那天的秒数
miao = miao % oneday;
//剩余那天的小时数
int xs = (int) (miao / 3600);
//剩余那天的分钟数
int fz = (int) ((miao - (xs * 3600)) / 60);
//最后剩余的秒数
int sm = (int) (miao - (xs * 3600) - fz * 60);
//System.out.println(String.format("%02d:%02d:%02d", xs, fz, sm));
System.out.printf("%02d:%02d:%02d", xs, fz, sm);
sc.close();
}
}