%02d

小乐乐定闹钟

http://www.nowcoder.com/questionTerminal/0f7e422e12be4a7f9958ca2a82abc775

import java.util.*;
public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String[] s = sc.nextLine().split("[: ]");
        int h = Integer.parseInt(s[0]), m = Integer.parseInt(s[1]), t = Integer.parseInt(s[2]);
        m = m + t;
        h = (h + m/60)%24;
        m = m%60;
        System.out.printf("%02d:%02d", h, m);
    }
}
全部评论

相关推荐

2 收藏 评论
分享
牛客网
牛客企业服务