PS/Baekjoon Online Judge

[백준 06812] Good times [Python]

kimyoungrok 2024. 8. 8. 22:16
728x90

A mobile cell service provider in Ottawa broadcasts an automated time standard to its mobile users that reflects the local time at the user’s actual location in Canada. This ensures that text messages have a valid local time attached to them.

For example, when it is 1420 in Ottawa on Tuesday February 24, 2009 (specified using military, 24 hour format), the times across the country are shown in the table below:

Pacific TimeMountain TimeCentral TimeEastern TimeAtlantic TimeNewfoundland Time

Write a program that accepts the time in Ottawa in 24 hour format and outputs the local time in each of the cities listed above including Ottawa. You should assume that the input time will be valid (i.e., an integer between 0 and 2359 with the last two digits being between 00 and 59).

You should note that 2359 is one minute to midnight, midnight is 0, and 13 minutes after midnight is 13. You do not need to print leading zeros, and input will not contain any extra leading zeros.


풀이

주어진 Ottawa의 시간을 기준으로 다른 지역의 시간을 계산하고 출력하는 문제다.

입력받은 시간이 유효하도록 바꾸고

만약 60분 이상으로 시간이 올바르지 않은 경우 60분을 빼주고 시간을 올려주자.

이 때 시간이 24시를 넘길 수 있다. 넘는 경우 00시로 변환하자.

 


소스코드

보기


출처

https://www.acmicpc.net/problem/6812

728x90