题目链接 codeforces 851B
题意
给出三个点,问将其三点按照某一个点旋转,能否将 a点 转到 b点 的同时,将 b点转到 c 点
题解
初中知识,如果b点在a和c的垂直平分线上时,圆心就在三条垂直平分线的交点,三个点此时在一个圆上,此时满足题意,输出YES,否则NO,三点不能共线
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod = 998244353;
struct node{
ll x, y;
}a, b, c;
ll dis(node a, node b){
return (a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y);
}
ll gong(node a, node b, node c){
return (a.x - b.x) * (c.y - b.y) == (c.x - b.x) * (a.y - b.y);
}
int main(){
cin >> a.x >> a.y >> b.x >> b.y >> c.x >> c.y;
if(dis(a, b) == dis(b, c) && !gong(a, b, c)){
cout << "YES" << endl;
}
else{
cout << "NO" << endl;
}
return 0;
}

本文解析了 Codeforces 851B 题目的解题思路,通过判断三个点是否位于同一圆上,来确定是否可以通过旋转使一点到达另一点的位置。使用了基本的几何原理和编程技巧。
429

被折叠的 条评论
为什么被折叠?



