본문 바로가기
python-algorithm

백준 28113 정보섬의 대중교통

by 무적김두칠 2023. 6. 7.

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

 

28113번: 정보섬의 대중교통

버스에 더 먼저 탑승할 수 있으면 Bus, 지하철에 더 먼저 탑승할 수 있으면 Subway, 버스와 지하철에 탑승하게 되는 시간이 동일하면 Anything을 출력한다.

www.acmicpc.net

 

1
2
3
4
5
6
7
8
9
10
11
12
13
def solution(n, a, b):
    if a == b:
        return 'Anything'
    elif a < b:
        return 'Bus'
    else:
        return 'Subway'
 
 
if __name__ == '__main__':
    n, a, b = map(int, input().split())
    print(solution(n, a, b))
 
cs

요구사항 중에 N이 B보다 무조건 작거나 같으므로 길을 걷는데 지하철이 출발하는 경우는 고려할 필요가 없습니다.
Among the requirements, since N is always less than or equal to B, there is no need to consider the case where the subway departs while walking on the street.

반응형

'python-algorithm' 카테고리의 다른 글

백준 28097 모범생 포닉스  (0) 2023.06.08
백준 27890 특별한 작은 분수  (0) 2023.06.08
leetcode 2652. Sum Multiples  (0) 2023.05.16
백준 27959 초코바  (0) 2023.04.25
leetcode 1431. Kids With the Greatest Number of Candies  (0) 2023.04.17

댓글