728x90
반응형
백준 BAEKJOON 28225번 Flower Festival [PYTHON/파이썬]
<문제 출처> (BRONZE Ⅲ)
https://www.acmicpc.net/problem/28225
28225번: Flower Festival
Today is the Flower Festival day. The festival is held in Rose Square, at the end of Flower Street. People are heading towards the festival on Flower Street with n cars, numbered 1 through n. Soroush, an expert traffic analyst, wants to know which car will
www.acmicpc.net
<풀이>
(목표 거리 - 현재 위치) / 속력을 활용하여 풀었다.
<코드>
n, f = map(int, input().split())
record = []
for _ in range(n):
x, v = map(int, input().split())
record.append((f - x) / v) # (목표 거리 - 현재 위치) / 속력
print(record.index(min(record)) + 1)
728x90
반응형
'ALGORITHM > PYTHON' 카테고리의 다른 글
백준 BAEKJOON 28113번 정보섬의 대중교통 [PYTHON/파이썬] (0) | 2023.06.27 |
---|---|
백준 BAEKJOON 17618번 신기한 수 [PYTHON/파이썬] (0) | 2023.06.23 |
백준 BAEKJOON 28236번 점심시간 레이스 [PYTHON/파이썬] (0) | 2023.06.21 |
백준 BAEKJOON 28235번 코드마스터 2023 [PYTHON/파이썬] (0) | 2023.06.20 |
백준 BAEKJOON 28062번 준석이의 사탕 사기 [PYTHON/파이썬] (0) | 2023.06.19 |