Codeforces Round #432 (Div. 2) B. Arpa and an exam about geometry(数学水题)

野性酷女 2022-06-09 11:24 298阅读 0赞

B. Arpa and an exam about geometry

time limit per test

2 seconds

memory limit per test

256 megabytes

input

standard input

output

standard output

Arpa is taking a geometry exam. Here is the last problem of the exam.

You are given three points a, b, c.

Find a point and an angle such that if we rotate the page around the point by the angle, the new position of a is the same as the old position of b, and the new position of b is the same as the old position of c.

Arpa is doubting if the problem has a solution or not (i.e. if there exists a point and an angle satisfying the condition). Help Arpa determine if the question has a solution or not.

Input

The only line contains six integers a**x, a**y, b**x, b**y, c**x, c**y (|a**x|, |a**y|, |b**x|, |b**y|, |c**x|, |c**y| ≤ 109). It’s guaranteed that the points are distinct.

Output

Print “Yes” if the problem has a solution, “No” otherwise.

You can print each letter in any case (upper or lower).

Examples

input

  1. 0 1 1 1 1 0

output

  1. Yes

input

  1. 1 1 0 0 1000 1000

output

  1. No

Note

In the first sample test, rotate the page around (0.5, 0.5) by 3beb169548b758ea60b306458d03196407afcd56.png.

In the second sample test, you can’t find any solution.

题解:

比赛还在进行但是我已经写不动了,10分钟过a题(太水不想写题解),20分钟过b题。。c题看不懂,d题不会做,e题。。。算了吧,虽然这题很水但还是水一发博客

题意:

给你3个点的坐标,问你是否能找到一个点,以该点为中心旋转一定的角度使得a与b重合,b与c重合

思路:

直接判断只要两个线段长度相同而且三个点不在同一直线上就行了

ps:

这题之前用double型40组数据出错估计是因为double精度不够,还有就是斜率不存在的时候会出问题,把数据类型改成long long,把斜率判等写成乘法就好了

暂时ac的代码:

  1. #include<iostream>
  2. #include<cstring>
  3. #include<stdio.h>
  4. #include<math.h>
  5. #include<string>
  6. #include<stdio.h>
  7. #include<queue>
  8. #include<stack>
  9. #include<map>
  10. #include<vector>
  11. #include<deque>
  12. #include<algorithm>
  13. using namespace std;
  14. #define INF 100861111
  15. #define ll long long
  16. #define eps 1e-7
  17. #define maxn 20
  18. int main()
  19. {
  20. long long x1,y1,x2,y2,x3,y3,k1,k2,d1,d2;
  21. scanf("%lld%lld%lld%lld%lld%lld",&x1,&y1,&x2,&y2,&x3,&y3);
  22. d1=(x1-x2)*(x1-x2)+(y1-y2)*(y1-y2);
  23. d2=(x2-x3)*(x2-x3)+(y2-y3)*(y2-y3);
  24. if(d1!=d2)
  25. {
  26. printf("No\n");
  27. return 0;
  28. }
  29. if((x2-x3)*(y1-y2)==(x1-x2)*(y2-y3))
  30. {
  31. printf("No\n");
  32. }
  33. else
  34. printf("Yes\n");
  35. return 0;
  36. }

发表评论

表情:
评论列表 (有 0 条评论,298人围观)

还没有评论,来说两句吧...

相关阅读