QOJ.ac

QOJ

Time Limit: 1 s Memory Limit: 512 MB Total points: 100

#3772. 점에서 원호까지의 거리

Statistics

점 $P$와 원호(원주의 일부)가 입력으로 주어진다. 당신의 과제는 $P$에서 원호까지의 최단 거리를 계산하는 것이다. 즉, 원호 위에서 점 $P$까지의 거리가 가장 짧은 점을 찾아야 한다.

힌트: 가능한 한 정확한 알고리즘을 사용하라. 근사 알고리즘으로는 이 문제의 테스트를 통과하기가 더 어렵다.

입력

입력에는 최대 10000개의 테스트 케이스가 있다. 각 테스트 케이스는 8개의 정수 $x_1, y_1, x_2, y_2, x_3, y_3, x_p, y_p$를 포함한다. 원호는 $A(x_1,y_1)$에서 시작하여 $B(x_2,y_2)$를 지나 $C(x_3,y_3)$에서 끝난다. 점 $P$의 위치는 $(x_p,y_p)$이다. $A, B, C$는 서로 다르고 한 직선 위에 있지 않음이 보장된다. 위의 모든 점의 좌표의 절댓값은 $20$을 넘지 않는다.

출력

각 테스트 케이스마다 테스트 케이스 번호와 $P$에서 원호까지의 거리를 소수점 아래 세 자리까지 출력한다. 출력과 정답 출력 사이의 오차는 최대 $0.001$까지 허용된다.

예제

입력 1

0 0 1 1 2 0 1 -1
3 4 0 5 -3 4 0 1

출력 1

Case 1: 1.414
Case 2: 4.000

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.