当前位置:网站首页>2022.7.29-----leetcode.593
2022.7.29-----leetcode.593
2022-07-30 03:57:00 【Road Lu727】
long len = -1;
public boolean validSquare(int[] a, int[] b, int[] c, int[] d) {
return calc(a, b, c) && calc(a, b, d) && calc(a, c, d) && calc(b, c, d);
}
boolean calc(int[] a, int[] b, int[] c) {
long l1 = (a[0] - b[0]) * (a[0] - b[0]) + (a[1] - b[1]) * (a[1] - b[1]);
long l2 = (a[0] - c[0]) * (a[0] - c[0]) + (a[1] - c[1]) * (a[1] - c[1]);
long l3 = (b[0] - c[0]) * (b[0] - c[0]) + (b[1] - c[1]) * (b[1] - c[1]);
boolean ok = (l1 == l2 && l1 + l2 == l3) || (l1 == l3 && l1 + l3 == l2) || (l2 == l3 && l2 + l3 == l1);
if (!ok) return false;
if (len == -1) len = Math.min(l1, l2);
else if (len == 0 || len != Math.min(l1, l2)) return false;
return true;
}
边栏推荐
- Monitor page deployment
- Eureka注册中心
- Hystrix 服务熔断
- 小程序毕设作品之微信二手交易小程序毕业设计成品(1)开发概要
- Mini Program Graduation Works WeChat Second-hand Trading Mini Program Graduation Design Finished Works (7) Interim Inspection Report
- Gateway routing gateway
- 小程序毕设作品之微信二手交易小程序毕业设计成品(6)开题答辩PPT
- Nacos namespace
- Organizations Going Online: A New Trend in Organizational Digital Transformation
- 【驱动】udev为USB转4串口的每个串口起别名
猜你喜欢

spicy (1) basic definition

Pytorch框架学习记录3——Transform的使用

小程序毕设作品之微信积分商城小程序毕业设计成品(5)任务书

逆向分析实战2

Has been empty, a straightforward, continue to copy the top off!

Nacos实现高可用

Nacos namespace

Hystrix 服务熔断

Nacos cluster partition

Mini Program Graduation Works WeChat Second-hand Trading Mini Program Graduation Design Finished Works (3) Background Functions
随机推荐
Mini Program Graduation Works WeChat Second-hand Trading Mini Program Graduation Design Finished Works (7) Interim Inspection Report
使命、愿景、价值观到底有什么区别
cv2.polylines
Starlight does not ask passers-by!The young lady on the Wuhan campus successfully switched to software testing in three months and received a salary of 9k+13!
Transformation of traditional projects
[ 云原生之谜 ] 云原生背景 && 定义 && 相关技术详解?
Smart answer function, CRMEB knowledge payment system must have!
TCP拥塞控制技术 与BBR的加速原理
Pytorch框架学习记录3——Transform的使用
Tcp编程
AI智能安防视频平台EasyCVR如何配置音视频同时传输?
Mini Program Graduation Works WeChat Points Mall Mini Program Graduation Design Finished Work (7) Interim Inspection Report
数组和结构体
STM32 SPI+WM8978 voice loopback
spicy (1) basic definition
小程序毕设作品之微信二手交易小程序毕业设计成品(3)后台功能
小程序毕设作品之微信积分商城小程序毕业设计成品(6)开题答辩PPT
Send it to your friends and let TA treat you to fried chicken!
TCP congestion control technology and acceleration principle of BBR
护网行动基本介绍