解题思路:
注意事项:
第二个循环时,不要提前计算,在输出时直接结算结果,否则会时间超限
参考代码:
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int ns[]=new int[n]; for (int i = 0; i < ns.length; i++) { ns[i]=sc.nextInt(); } for (int i = 0; i < ns.length; i++) { //%02d:d表示数字类型,2表示数字长度为2,0表示长度不足2时自动补0(默认补空格) System.out.printf("%02d:%02d:%02d\n",ns[i]/3600,ns[i]/60%60,ns[i]%60); } } }
0.0分
1 人评分
时间转换 (Java代码)浏览:572 |
C语言程序设计教程(第三版)课后习题10.2 (C语言代码)浏览:504 |
C语言程序设计教程(第三版)课后习题6.9 (C语言代码)浏览:628 |
简单的a+b (C语言代码)浏览:414 |
杨辉三角 (C语言代码)浏览:484 |
1050题解(结构体数组与结构体指针的使用)浏览:1107 |
C二级辅导-计负均正 (C语言代码)浏览:480 |
陶陶摘苹果2 (C语言代码)浏览:596 |
C语言程序设计教程(第三版)课后习题7.4 (C语言代码)浏览:484 |
盐水的故事 (C语言代码)浏览:1524 |