解题思路:这是一道简单的模拟题,需要注意的是当t=0时的输出形式,其他情况就是不断对60取模,分离出秒,分,时,然后按照规定格式输出即可
注意事项:
参考代码:
import java.io.*;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.math.RoundingMode;
import java.util.*;
import javax.management.RuntimeErrorException;
public class Main {
static class InputReader
{
public BufferedReader br;
public StringTokenizer tokenizer;
public InputReader(InputStream ins)
{
br=new BufferedReader(new InputStreamReader(ins));
tokenizer=null;
}
public String next()
{
while(tokenizer==null||! tokenizer.hasMoreTokens())
{
try {
tokenizer=new StringTokenizer(br.readLine());
} catch (Exception e) {
// TODO: handle exception
throw new RuntimeException(e);
}
}
return tokenizer.nextToken();
}
public int nextInt()
{
return Integer.parseInt(next());
}
public Long nextLong()
{
return Long.parseLong(next());
}
public double nextDouble()
{
return Double.parseDouble(next());
}
public String nextLine() throws IOException
{
return br.readLine();
}
}
public static InputReader in;
public static PrintWriter out;
static int N=200000;
static int mod=10007;
static class Task
{
public void solve(InputReader in,PrintWriter out)
{
int t=in.nextInt();
if(t==0)
{
out.println("0:0:0");
return;
}
int second=t%60;
t/=60;
int minute=t%60;
int hour=t/60;
out.println(hour+":"+minute+":"+second);
}
}
public static void main(String[] args) throws IOException{
//InputStream ins=new FileInputStream("C:\\input.txt");
InputStream ins=System.in;
in=new InputReader(ins);
out=new PrintWriter(System.out);
new Task().solve(in, out);
out.close();
}
}
0.0分
0 人评分
C语言程序设计教程(第三版)课后习题10.1 (C语言代码)浏览:1518 |
C语言程序设计教程(第三版)课后习题6.11 (C语言代码)for循环浏览:1178 |
【明明的随机数】 (C++代码)浏览:834 |
C语言程序设计教程(第三版)课后习题5.5 (C语言代码)浏览:577 |
C语言程序设计教程(第三版)课后习题6.3 (C语言代码)浏览:688 |
蛇行矩阵 (C语言代码)浏览:606 |
sizeof的大作用 (C语言代码)浏览:1593 |
C语言程序设计教程(第三版)课后习题9.6 (C语言代码)浏览:627 |
找出最长的字符串来 (C语言代码)浏览:1840 |
多组数据新方法浏览:368 |