分支-12. 计算火车运行时间(15)
来源:互联网 发布:美国原油库存数据 编辑:程序博客网 时间:2024/05/02 21:37
本题要求根据火车的出发时间和达到时间,编写程序计算整个旅途所用的时间。
输入格式:
输入在一行中给出2个4位正整数,其间以空格分隔,分别表示火车的出发时间和到达时间。每个时间的格式为2位小时数(00-23)和2位分钟数(00-59),假设出发和到达在同一天内。
输出格式:
在一行输出该旅途所用的时间,格式为“hh:mm”,其中hh为2位小时数、mm为2位分钟数。
输入样例:1201 1530输出样例:
03:29
import java.util.Scanner;public class Main {public static void main(String[] args) {Scanner cin = new Scanner(System.in);int a = cin.nextInt();int b = cin.nextInt();int c = b - a;if (b % 100 < a % 100) {System.out.printf("%02d:%02d", c / 100, c % 100 - 40);} else {System.out.printf("%02d:%02d", c / 100, c % 100);}}}
0 0
- 分支-12. 计算火车运行时间(15)
- 分支-12. 计算火车运行时间(15)
- 分支-12. 计算火车运行时间(15)
- 分支-12. 计算火车运行时间(15)
- 分支-12. 计算火车运行时间(15)
- 分支-12. 计算火车运行时间(15)*
- 分支-12. 计算火车运行时间(15)
- 分支-12 计算火车运行时间(15)
- 计算火车运行时间
- 计算火车运行时间(c语言)
- 计算程序运行时间
- 计算程序运行时间
- 精确计算运行时间
- 程序运行时间计算
- 计算程序运行时间
- 计算程序运行时间
- 计算运行时间
- 计算程序运行时间
- 容器开发
- leetcode-Subsets
- zoj3789 Gears并查集
- 警告: com.mchange.v2.async.ThreadPoolAsynchronousRunner$DeadlockDetector@513098 -- APPARENT DEADLOCK!!
- (难度:18%)可拖动的照片管理系统
- 分支-12. 计算火车运行时间(15)
- 理解 pkg-config 工具
- LeetCode: Interleaving String [097]
- 【Espruino】NO.08 使用PWM驱动蜂鸣器奏乐
- Qt中的 Size Hints 和 Size Policies
- JK latch JK触发器 【数字电路】
- LeetCode: Validate Binary Search Tree [098]
- oracle的dump函数应用
- Spring事务的传播行为