题解 | 时间转换

时间转换

https://www.nowcoder.com/practice/c4ae7bcac7f9491b8be82ee516a94899

import java.util.Scanner;

// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int s=in.nextInt();
        int h=0;
        int se=0;
        int m=0;
        if(s>=3600)
        {
           h=s/3600;
           s=s-h*3600;
        }
        if(s>=60)
        {
           se=s/60;
           s=s-60*se;
        }
         m=s;
    System.out.println(h+" "+se+" "+ m);   
    in.close();   
        }
    }

全部评论

相关推荐

牛至超人:我将凌晨两点给你打电话
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务