반응형
[ Contents ]
1. 문제 (링크 참조)
5928번: Contest Timing
Bessie the cow is getting bored of the milk production industry, and wants to switch to an exciting new career in computing. To improve her coding skills, she decides to compete in the on-line USACO competitions. Since she notes that the contest starts on
www.acmicpc.net
2. 문제 풀이
대회는 11일 11시 11분에 시작합니다. 입력된 대회 종료시간을 통해, Bessie가 응시한 시간을 구해야 합니다.
3. 코드
import sys
input = sys.stdin.readline
# 입력
D, H, M = map(int, input().split())
# 시간 계산
time = (D-11)*60*24 + (H-11)*60 + (M-11)
print(time if time >= 0 else -1)
[종료시간 - 시작시간]을 하면 응시한 시간을 알 수 있습니다. 만약 음수라면, 종료시간이 11일 11시 11분보다 이전이라는 뜻입니다.
반응형
'Algorithm' 카테고리의 다른 글
[구현/문자열] 백준 17863 FYI - 파이썬(Python) (0) | 2022.08.01 |
---|---|
[자료구조/해시] 백준 20232 Archivist - 파이썬(Python) (0) | 2022.07.31 |
[구현/수학] 백준 24723 녹색거탑 - 파이썬(Python) (0) | 2022.07.29 |
[구현/수학] 백준 15921 수찬은 마린보이야!! - 파이썬(Python) (0) | 2022.07.28 |
[분할정복/DP] 백준 15624 피보나치 수 7 - 파이썬(Python) (0) | 2022.07.27 |
댓글