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

9380번 - Blast the Enemy! 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 128 MB12111090.909%

문제

A new computer game has just arrived and as an active and always-in-the-scene player, you should finish it before the next university term starts. At each stage of this game, you have to shoot an enemy robot on its weakness point. The weakness point of a robot is always the “center of mass” of its 2D shape in the screen. Fortunately, all robot shapes are simple polygons with uniform density and you can write programs to calculate exactly the center of mass for each polygon.

Let's have a more formal definition for center of mass (COM). The center of mass for a square, (also circle, and other symmetric shapes) is its center point. And, if a simple shape C is partitioned into two simple shapes A and B with areas SA and SB, then COM(C) (as a vector) can be calculated by
\( COM(C) = \frac{S_A \times COM(A)+ S_B \times COM(B)}{S_A + S_B} \)

As a more formal definition, for a simple shape A with area SA:
\( COM(A) = \frac{ \iint_{A} \vec{a}\cdot ds}{S_A} \)

입력

The input contains a number of robot definitions. Each robot definition starts with a line containing n, the number of vertices in robot’s polygon (n <= 100). The polygon vertices are specified in the next n lines (in either clockwise or counter-clock-wise order). Each of these lines contains two space-separated integers showing the coordinates of the corresponding vertex. The absolute value of the coordinates does not exceed 100. The case of n=0 shows the end of input and should not be processed.

출력

The ith line of the output should be of the form “Stage #i: x y” (omit the quotes), where (x,y) is the center of mass for the ith robot in the input. The coordinates must be rounded to exactly 6 digits after the decimal point.

제한

예제 입력 1

4
0 0
0 1
1 1
1 0
3
0 1
1 0
2 2
8
1 1
2 1
2 7
3 7
3 0
0 0
0 7
1 7
0

예제 출력 1

Stage #1: 0.500000 0.500000
Stage #2: 1.000000 1.000000
Stage #3: 1.500000 3.300000

힌트

출처

ICPC > Regionals > Asia West Continent > Iran > Tehran Site 2008 D번

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

출처

대학교 대회

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

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