博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Leetcode-5051 Valid Boomerang(有效的回旋镖)
阅读量:4343 次
发布时间:2019-06-07

本文共 1035 字,大约阅读时间需要 3 分钟。

1 class Solution 2 { 3     public: 4         bool isBoomerang(vector
>& points) 5 { 6 if(points[0][0] == points[1][0] && points[0][1] == points[1][1] 7 || points[1][0] == points[2][0] && points[1][1] == points[2][1] 8 ||points[0][0] == points[2][0] && points[0][1] == points[2][1] 9 || points[0][0] == points[1][0] && points[1][0] == points[2][0]10 || points[0][1] == points[1][1] && points[1][1] == points[2][1])11 return false;12 double a = (double)(points[0][0] - points[1][0]) / (points[0][1] - points[1][1]);13 double b = (double)(points[1][0] - points[2][0]) / (points[1][1] - points[2][1]);14 double c = (double)(points[0][0] - points[2][0]) / (points[0][1] - points[2][1]);15 16 if(abs(a-b)<1e-3 && abs(a-c)<1e-3)17 return false;18 return true;19 }20 };

也不知道在写什么,加特判加一堆,还好过了

转载于:https://www.cnblogs.com/Asurudo/p/10812273.html

你可能感兴趣的文章
jQueru中数据交换格式XML和JSON对比
查看>>
form表单序列化后的数据转json对象
查看>>
[PYTHON]一个简单的单元測试框架
查看>>
[BZOJ4303]数列
查看>>
一般处理程序在VS2012中打开问题
查看>>
C语言中的++和--
查看>>
thinkphp3.2.3入口文件详解
查看>>
POJ 1141 Brackets Sequence
查看>>
Ubuntu 18.04 root 使用ssh密钥远程登陆
查看>>
Servlet和JSP的异同。
查看>>
虚拟机centOs Linux与Windows之间的文件传输
查看>>
ethereum(以太坊)(二)--合约中属性和行为的访问权限
查看>>
IOS内存管理
查看>>
middle
查看>>
[Bzoj1009][HNOI2008]GT考试(动态规划)
查看>>
Blob(二进制)、byte[]、long、date之间的类型转换
查看>>
OO第一次总结博客
查看>>
day7
查看>>
iphone移动端踩坑
查看>>
vs无法加载项目
查看>>