内容简介:问题描述给定一个以秒为单位的时间t,要求用“输入格式
问题描述
给定一个以秒为单位的时间t,要求用“
”的格式来表示这个时间。
表示秒,它们都是整数且没有前导的“0”。例如,若t=0,则应输出是“0:0:0”;若t=3661,则输出“1:1:1”。
输入格式
输入只有一行,是一个整数t(0<=t<=86399)。
输出格式
输出只有一行,是以“
”的格式所表示的时间,不包括引号。
样例输入
0
样例输出
0:0:0
样例输入
5436
样例输出
1:30:36
package base14;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner inScanner = new Scanner(System.in);
//输入秒
long time = inScanner.nextLong();
inScanner.close();
int h = (int) (time / 3600);
time %= 3600;
int m = (int) (time / 60);
int s = (int) (time % 60);
System.out.println(h + ":" + m + ":" + s);
}
}
❤❤点击这里 -> 订阅PAT、蓝桥杯、GPLT天梯赛、LeetCode题解离线版❤❤
以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网
本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
Agile Web Application Development with Yii 1.1 and PHP5
Jeffrey Winesett / Packt Publishing / 2010-08-27
In order to understand the framework in the context of a real-world application, we need to build something that will more closely resemble the types of applications web developers actually have to bu......一起来看看 《Agile Web Application Development with Yii 1.1 and PHP5》 这本书的介绍吧!