
代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
| #!/usr/bin/env python
# -*- coding: utf-8 -*-
# author: a2htray
# create date: 2023/3/9
"""
PAT 乙级 1026
"""
if __name__ == '__main__':
start_clock, end_clock = map(int, input().split(' '))
duration = 1.0 * (end_clock - start_clock) / 100
h = int(duration // 3600)
m = int(duration % 3600 // 60)
s = str(duration % 3600 % 60)
tokens = s.split('.')
add = 1 if int(tokens[1][0]) >= 5 else 0
s = int(tokens[0]) + add
print('%02d:%02d:%02d' % (h, m, s))
|