ALGORITHM/PYTHON

백준 BAEKJOON 28225번 Flower Festival [PYTHON/파이썬]

칼코
반응형

 

 

 

 

 

백준 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

백준 28225번 한국어로 번역한 사진

 

 

 

 

 

<풀이>

(목표 거리 - 현재 위치) / 속력을 활용하여 풀었다.

 

 

 

 

 

 

<코드>

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)

 

 

 

 

 

반응형