https://level.goorm.io/exam/43059/파도-센서/quiz/1
구름LEVEL
코딩테스트에서 가장 높은 비중을 차지하는 알고리즘 문제를 제작하고 풀이할 수 있는 온라인 저지 서비스입니다. 기업에서 선호하는 C, C++, 파이썬(Python), 자바(Java), 자바스크립트(Javascript) 이
level.goorm.io
X, Y, R = map(int,input().split())
sensor = []
sensor.append(list(map(int,input().split())))
sensor.append(list(map(int,input().split())))
sensor.append(list(map(int,input().split())))
sensor.append(list(map(int,input().split())))
sensor.append(list(map(int,input().split())))
# 센서별 발생지로부터 거리 측정
for i in range(0, len(sensor)):
sensor[i] = ((X - (sensor[i][0]))**2 + (Y - (sensor[i][1]))**2)**0.5
# 거리가 R 보다 작은 값들 중 최저값(가장 센서에 먼저 닿는 값) 출력
if min(sensor) <= R:
print(sensor.index(min(sensor))+1)
else:
print(-1)
'코딩 > 구름' 카테고리의 다른 글
[구름 1단계] 헷갈리는 작대기 (0) | 2022.03.17 |
---|---|
[구름 1단계] 인공지능 청소기 (0) | 2022.03.16 |
[구름 1단계] 자동문 (0) | 2022.03.16 |
[구름 1단계] 가위바위보 (0) | 2022.03.16 |
[구름 1단계] 특정 문자 개수 구하기 (0) | 2022.03.16 |