Codeforces 851B
来源:互联网 发布:最短路径算法floyd实例 编辑:程序博客网 时间:2024/06/03 13:09
链接:
http://codeforces.com/contest/851/problem/B
题目:
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 ax, ay, bx, by, cx, cy (|ax|, |ay|, |bx|, |by|, |cx|, |cy| ≤ 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
0 1 1 1 1 0
output
Yes
input
1 1 0 0 1000 1000
output
No
Note
In the first sample test, rotate the page around (0.5, 0.5) by .
In the second sample test, you can’t find any solution.
题意:
给你三个点
思路:
首先,三个点一定能构成一个圆弧,于是转化一下问题就可以变成判断三个点两两在圆弧上的距离是否相等。因为在圆弧上的时候到圆心的距离都相等,所以当且仅当Yes
,否则输出No
。
实现:
#include <bits/stdc++.h>using namespace std;long long x[3], y[3];long long calc(int a, int b) { long long xx = x[a] - x[b], yy = y[a] - y[b]; return xx*xx + yy*yy;}long long check() { return (x[2] - x[1])*(y[1] - y[0]) == (x[1] - x[0])*(y[2] - y[1]);}int main() {#ifndef ONLINE_JUDGE freopen("in.txt","r",stdin);#endif for(int i=0 ; i<3 ; i++) scanf("%lld%lld", x+i, y+i); if(calc(0,1) == calc(1,2) && !check()) return puts("Yes"), 0; return puts("No"), 0;}
- Codeforces 851B
- codeforces B
- codeforces B
- codeforces B
- codeforces B
- CodeForces 626B CodeForces 626B【暴力】
- CodeForces 841B (B) 博弈
- codeforces 134B
- codeforces#98 b
- codeforces 105 div2 B
- Codeforces 166B - Polygons
- codeforces B. Coins
- codeforces----193B Xor
- codeforces----208B Solitaire
- Codeforces 1B - Spreadsheet
- codeforces 214B Hometask
- Codeforces Round #136 B
- CodeForces 224B Array
- matlab2c使用c++实现matlab函数系列教程-asin函数
- matlab2c使用c++实现matlab函数系列教程-sin函数
- Unity UGUI点击、拖动等事件
- matlab2c使用c++实现matlab函数系列教程-cos函数
- 《DevOps 实践》
- Codeforces 851B
- 莫队 + 组合 + 逆元 HDU 5145
- CAGradientlayer设置视图背景的渐变效果
- 基于ArcGIS的Python编程秘笈笔记(一):面向ArcGIS的Python语言基础
- Logstash安装配置
- Map集合的四种种遍历方式
- U盘无法复制进去东西,提示错误0x80071AC3 无法完成操作
- Django安装(windows)
- let和const命令