编程介的小学生 2017-09-08 08:36 采纳率: 20.5%
浏览 672
已采纳

Polylops

Given the vertices of a non-degenerate polygon (no 180-degree angles, zero-length sides, or self-intersection - but not necessarily convex), you must determine how many distinct lines of symmetry exist for that polygon. A line of symmetry is one on which the polygon, when reflected on that line, maps to itself.

Input

Input consists of a description of several polygons.

Each polygon description consists of two lines. The first contains the integer "n" (3 <= n <= 1000), which gives the number of vertices on the polygon. The second contains "n" pairs of numbers (an x- and a y-value), describing the vertices of the polygon in order. All coordinates are integers from -1000 to 1000.

Input terminates on a polygon with 0 vertices.

Output

For every polygon described, print out a line saying "Polygon #x has y symmetry line(s).", where x is the number of the polygon (starting from 1), and y is the number of distinct symmetry lines on that polygon.

Sample Input

4
-1 0 0 2 1 0 0 -1
3
-666 -42 57 -84 19 282
3
-241 -50 307 43 -334 498
0

Sample Output

Polygon #1 has 1 symmetry line(s).
Polygon #2 has 0 symmetry line(s).
Polygon #3 has 1 symmetry line(s).

  • 写回答

1条回答 默认 最新

  • threenewbee 2017-09-24 00:32
    关注
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 #MATLAB仿真#车辆换道路径规划
  • ¥15 java 操作 elasticsearch 8.1 实现 索引的重建
  • ¥15 数据可视化Python
  • ¥15 要给毕业设计添加扫码登录的功能!!有偿
  • ¥15 kafka 分区副本增加会导致消息丢失或者不可用吗?
  • ¥15 微信公众号自制会员卡没有收款渠道啊
  • ¥15 stable diffusion
  • ¥100 Jenkins自动化部署—悬赏100元
  • ¥15 关于#python#的问题:求帮写python代码
  • ¥20 MATLAB画图图形出现上下震荡的线条