codeforces 851 B. Arpa and an exam about geometry
来源:互联网 发布:mac上装ios模拟器 编辑:程序博客网 时间:2024/06/05 04:38
脑袋短路了,只要判断AB和BC距离是否同样就好了。写的时候有点短路,判断多了。。
#include <bits/stdc++.h>using namespace std;typedef long long LL;const double eps = 1e-8;struct Point{ Point(){} Point(double _a, double _b):x(_a),y(_b){} double x,y;};Point ps[3];int sgn(double x){ if(fabs(x) <= eps) return 0; if(x > 0) return 1; return -1;}double dist(Point a, Point b){ return sqrt((a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y));}bool check(){ Point cen((ps[0].x+ps[2].x)/2.0,(ps[0].y+ps[2].y)/2.0); Point ac(ps[2].x-ps[0].x,ps[2].y-ps[0].y); Point cenb(ps[1].x-cen.x,ps[1].y-cen.y); double t = ac.x*cenb.x+ac.y*cenb.y; Point ab(ps[1].x-ps[0].x,ps[1].y-ps[0].y); Point bc(ps[2].x-ps[1].x,ps[2].y-ps[1].y); double cj = ab.x*bc.y-ab.y*bc.x; return sgn(t)==0 && sgn(cj) != 0;}int main(){ ios::sync_with_stdio(false); for(int i = 0; i < 3; ++i) cin >> ps[i].x >> ps[i].y; double dis1,dis2,dis3; dis1 = dist(ps[0],ps[1]); dis2 = dist(ps[0],ps[2]); dis3 = dist(ps[1],ps[2]); if((sgn(dis1-dis2) == 0 || sgn(dis1-dis3) == 0 || sgn(dis2-dis3) == 0) && check()) cout << "Yes" <<endl; else cout << "No" << endl; return 0;}
阅读全文
0 0
- codeforces 851B Arpa and an exam about geometry
- codeforces 851 B. Arpa and an exam about geometry
- Codeforces 851 B Arpa and an exam about geometry
- Codeforces Round #432 B. Arpa and an exam about geometry
- Codeforces Round#432 B. Arpa and an exam about geometry
- Codeforces Round #432 B. Arpa and an exam about geometry
- B. Arpa and an exam about geometry
- codeforce 851 B Arpa and an exam about geometry(思路)
- Codeforces 851B && Round #432 Div. 2 B. Arpa and an exam about geometry
- Codeforces 851B. Arpa and an exam about geometry 计算几何,结论题
- Div#432B Arpa and an exam about geometry
- Codeforces Round #432 Div2 B. Arpa and an exam about geometry
- codeforces Div#432 B Arpa and an exam about geometry(技巧)
- Codeforces Round #432 (Div. 2) B Arpa and an exam about geometry
- Codeforces Round #432 (Div. 2) B. Arpa and an exam about geometry(数学水题)
- codeforces Round4 B. Before an Exam
- Codeforces 4B Before an Exam
- codeforces 4B Before an Exam
- hash+map 维护集合
- java类中为什么设置set和get方法
- 嵌入式Linux入门11:编程规范
- 【已解决】SpringMVC表单提交结果页面出现400错误的可能原因分析
- poj 3176 Cow Bowling
- codeforces 851 B. Arpa and an exam about geometry
- 浏览器打开一个网站可能经历哪些步骤
- Elasticsearch之—— 5.X head插件安装实例
- com.android.dx.cf.iface.ParseException
- python用类实现栈
- POJ
- QSS样式表
- 生产者/消费者的示例程序,生产者随机地产生若干个整数,消费者将这些整数输出到屏幕。
- PAT 1080. Graduate Admission (30) 已通过