列表

详情


NC207136. Duration

描述

Given two moments on the same day in the form of HH:MM:SS, print the number of seconds between the two moments.

输入描述

Input two lines each contains a string in the form of , denoting a given moment.

输出描述

Only one line containing one integer, denoting the answer.

示例1

输入:

12:00:00
17:00:00

输出:

18000

示例2

输入:

23:59:59
00:00:00

输出:

86399

原站题解

上次编辑到这里,代码来自缓存 点击恢复默认模板

pypy3(pypy3.6.1) 解法, 执行用时: 70ms, 内存消耗: 72064K, 提交时间: 2020-07-13 12:07:43

s=input().split(':')
w=input().split(':')
a=int(s[0])*3600+int(s[1])*60+int(s[2])
b=int(w[0])*3600+int(w[1])*60+int(w[2])
print(abs(a-b))

Python3(3.5.2) 解法, 执行用时: 17ms, 内存消耗: 3336K, 提交时间: 2020-07-13 12:04:18

def temp():
	H,M,S=[int(i) for i in input().split(':')]
	return H*3600+M*60+S
a=temp()
b=temp()
print(abs(a-b))

上一题