题解 | #小乐乐定闹钟#
小乐乐定闹钟
http://www.nowcoder.com/practice/0f7e422e12be4a7f9958ca2a82abc775
import java.io.*;
import java.time.LocalTime;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String[] arr = br.readLine().split(" ");
String[] startArr = arr[0].split(":");
// k分钟后
int k = Integer.parseInt(arr[1]);
// 拿到开始时间
int hour = Integer.parseInt(startArr[0]);
int minute = Integer.parseInt(startArr[1]);
LocalTime lt = LocalTime.of(hour, minute);
System.out.print(lt.plusMinutes(k));
}
}
查看14道真题和解析