2017-12-02 03:43 阅读 628

The troubles of lmy

Problem Description
Lmy is the lovely cousin of zmq, and she’s a junior high school student. One day she came back from school.
Zmq: What did you learn in your class today?
Lmy: Similar triangle.
Zmq: Well, fine, have you mastered it?
Lmy: Sure, that’s a piece of cake.
Zmq: OK, well, let me test you to see whether you have thoroughly understood the conception of being similar. I’ll draw two Arbitrary Polygons, and you have to tell me whether they are similar or not. If you are right, I’ll take you out.
Lmy: ……
It seems that little lmy got into troubles. Can you help her out by designing a program?

There are several test cases in the input.
The first line of each case is an n (n <= 300), indicating that each polygon has n points. And in the following 2n lines, each line represents a point. The first n point represents the first polygon in anti-clockwise order, and so the second. Please note that all the polygons are simple.
You can try to rotate them, then tell whether they are similar or not.

For each case, output “Yes” or “No”, showing whether they are similar.

Sample Input
0 0
1 1
0 1
0 0
2 2
0 2
0 0
1 1
0 1
0 0
2 2
0 1

Sample Output

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

1条回答 默认 最新