调试中...
调试中...
题目描述
题目描述
题解
题解
提交记录
提交记录
代码
代码
测试用例
测试用例
测试结果
测试结果
简单
相关标签
相关企业
提示

给你一个正整数 arrivalTime 表示列车正点到站的时间(单位:小时),另给你一个正整数 delayedTime 表示列车延误的小时数。

返回列车实际到站的时间。

注意,该问题中的时间采用 24 小时制。

 

示例 1:

输入:arrivalTime = 15, delayedTime = 5 
输出:20 
解释:列车正点到站时间是 15:00 ,延误 5 小时,所以列车实际到站的时间是 15 + 5 = 20(20:00)。

示例 2:

输入:arrivalTime = 13, delayedTime = 11
输出:0
解释:列车正点到站时间是 13:00 ,延误 11 小时,所以列车实际到站的时间是 13 + 11 = 24(在 24 小时制中表示为 00:00 ,所以返回 0)。

 

提示:

  • 1 <= arrivaltime < 24
  • 1 <= delayedTime <= 24
通过次数
47.1K
提交次数
54.6K
通过率
86.3%

相关标签

相关企业

提示 1
Use the modulo operator to handle the case when the arrival time plus the delayed time goes beyond 24 hours.

提示 2
If the arrival time plus the delayed time is greater than or equal to 24, you can also subtract 24 to get the time in the 24-hour format.

评论 (0)

贡献者
© 2025 领扣网络(上海)有限公司
0 人在线
行 1,列 1
运行和提交代码需要登录
arrivalTime =
15
delayedTime =
5
Source