NC214942. SakuyaloveLovesCircles
描述
输入描述
输出描述
示例1
输入:
2 -1 27 21 23 6 -22 -19 3 0 1 1 1 1 0 -1 0
输出:
yes no
C++ 解法, 执行用时: 3ms, 内存消耗: 404K, 提交时间: 2021-12-15 00:31:07
#include<iostream> using namespace std; int t; double x1,x2,x3,x4,y1,y2,y3,y4; int main(){ cin>>t; while(t--){ cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4; double e=x1*x1-x2*x2+y1*y1-y2*y2; double f=x1*x1-x3*x3+y1*y1-y3*y3; double d=4*(x1-x2)*(y1-y3)-4*(x1-x3)*(y1-y2); double x=(e*2*(y1-y3)-f*2*(y1-y2))/d; double y=(f*2*(x1-x2)-e*2*(x1-x3))/d; double r=(x1-x)*(x1-x)+(y1-y)*(y1-y); double res=(x-x4)*(x-x4)+(y-y4)*(y-y4); if(abs(r-res)<1e-12) cout<<"yes\n"; else cout<<"no\n"; } }