编程介的小学生 2019-08-28 22:00 采纳率: 20.5%
浏览 60

The Perfect Symmetry

Description

The representatives of NATO countries must be guarded by many bodyguards during the Summit. Each V.I.P. is accompanied by his own bodyguards but is also assigned many other specialists, snipers, etc. To make their work efficient and the guarded person secure as much as possible, the bodyguards must be distributed to various directions from the person.

The optimal placement of bodyguards is such that the V.I.P. stands in the center of symmetry of all guards. Unfortunately, when the V.I.P. moves, it is very hard to reconfigure the bodyguards' positions to reflect the new situation. Most of the Czech specialists are not able to do such reconfigurations in real-time.

Therefore, the Home Affairs Minister Sobeslav Gros has decided to reverse this procedure. The bodyguards take their places first. Then, it is the responsibility of the V.I.P. to find the proper position in the center of symmetry. If the person appears anywhere else, we take no responsibility for his/her security.

Your task is to automate the process. Given a set of N points (bodyguard positions), you are to find its center of symmetry S, where the V.I.P. is relatively safe. More formal description follows.

Let's have a point A and the center of symmetry S. We say that another point A' is the image of the point A according to the center of symmetry S iff S is the center of the line joining points A and A'.

The image of the set of points (X) according to the center S is the set of all images of individual points in that set. The set X is said to possess a center of symmetry, if there exists a point S such that the image of the set X according to the center S is equal to the set X itself.
Input

The input consists of several assignments. Each assignment begins with a line containing a single integer number N, 1 <= N <= 20000. It is followed by N lines, each containing two integer numbers Xi and Yi separated with a space, -105 <= |Xi,Yi| <= 105. These are the Cartesian coordinates of the i-th point in the set.

Since no two bodyguards occupy the same place, no point will appear twice in the same assignment. However, note that a bodyguard can be in the same place as the V.I.P.

After the last assignment, there is a line containing zero instead of the number of points. This line should not be processed.
Output

For each assignment, output exactly one line. If the given set possesses a center of symmetry, print the text "V.I.P. should stay at (X,Y)." where X and Y are the Cartesian coordinates of the center rounded to the nearest number with exactly one digit after the decimal point.

If there is no center of symmetry, output the text: "This is a dangerous situation!".
Sample Input

8
1 10
3 6
6 8
6 2
3 -4
1 0
-2 -2
-2 4
4
2 1
4 1
5 1
6 1
0
Sample Output

V.I.P. should stay at (2.0,3.0).
This is a dangerous situation!

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 虚拟机打包apk出现错误
    • ¥30 最小化遗憾贪心算法上界
    • ¥15 用visual studi code完成html页面
    • ¥15 聚类分析或者python进行数据分析
    • ¥15 逻辑谓词和消解原理的运用
    • ¥15 三菱伺服电机按启动按钮有使能但不动作
    • ¥15 js,页面2返回页面1时定位进入的设备
    • ¥50 导入文件到网吧的电脑并且在重启之后不会被恢复
    • ¥15 (希望可以解决问题)ma和mb文件无法正常打开,打开后是空白,但是有正常内存占用,但可以在打开Maya应用程序后打开场景ma和mb格式。
    • ¥20 ML307A在使用AT命令连接EMQX平台的MQTT时被拒绝