Logo
(追記) (追記ここまで)

9298번 - Ant Entrapment 스페셜 저지다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
3 초 256 MB104957143652.530%

문제

Recently, your friend Oscar purchased an ant farm. He accidentally let the ants loose on his floor and now they’re crawling everywhere! You want to fence them off with a single continuous rectangle so that they’re not running amok. However, due to technical limitations your fence pieces must be aligned with the X and Y axes. The figure below shows an example of a fence around a set of ants (slight offsets from the border are just for visual effect).

What is the perimeter and area of the smallest fence that contains all of the ants?

입력

The first line of input is the number of test cases that follow. Each test case starts with an integer N (1 ≤ N ≤ 100) on a line by itself representing the number of ants. The following N lines of input contain two floating-point values X and Y (−1000.0 ≤ X, Y ≤ 1000.0) representing the position of an ant. You can assume that ants are single points–they have no area.

출력

For each case output the line “Case x:” where x is the case number, on a single line, followed by the string “Area” and the area of the fence as a floating-point value and then a comma, followed by a space and then “Perimeter” and the perimeter of the fence as a floating-point value. Floating-point value will be considered correct if it is within an absolute or relative error of 10-9 of the correct answer.

제한

예제 입력 1

2
3
-1.000 0.000
5.000 11.500
3.200 -4.250
2
2.125 0.500
6.875 9.100

예제 출력 1

Case 1: Area 94.5, Perimeter 43.5
Case 2: Area 40.85, Perimeter 26.7

힌트

출처

School > University of Virginia High School Programming Contest > UVa HSPC 2012 C번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /