https://www.acmicpc.net/problem/14625
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
def sol(start_total, end_total, target):
answer = 0
while str(start_total)!=str(end_total+1):
str_hh = str(start_total//60)
str_mm = str(start_total % 60)
if len(str_mm) == 1:
str_mm = '0' + str_mm
if len(str_hh) == 1:
str_hh = '0' + str_hh
if target in str_hh or target in str_mm :
answer += 1
start_total += 1
return answer
if __name__ == '__main__':
start_hh, start_mm = map(int, input().split())
start_total = start_hh*60+ start_mm
end_hh, end_mm = map(int, input().split())
end_total = end_hh*60+ end_mm
target = input()
print(sol(start_total, end_total, target))
|
cs |
시간 관련 문제는 시간 단위를 환산해서 계산하시는게 편해요
It is convenient to calculate time-related problems by converting units of time.
반응형
'python-algorithm' 카테고리의 다른 글
백준 15080 Every Second Counts (0) | 2022.12.04 |
---|---|
백준 26209 Intercepting Information (0) | 2022.12.04 |
백준 5698 Tautogram (0) | 2022.12.03 |
백준 21867 Java Bitecode (0) | 2022.12.03 |
백준 23627 driip (0) | 2022.12.02 |
댓글