python-algorithm
백준 28113 정보섬의 대중교통
무적김두칠
2023. 6. 7. 13:56
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.
반응형