当前位置:网站首页>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;
}
边栏推荐
- Hystrix 服务熔断
- Gateway 路由网关
- List获取差集产生的问题
- 传统项目转型
- [Node accesses MongoDB database]
- Transformation of traditional projects
- Wechat second-hand transaction small program graduation design finished product (1) Development overview
- mysql 结构、索引详解
- 骁龙7系芯片表现如何?Reno8 Pro佐证新一代神U
- How does the AI intelligent security video platform EasyCVR configure the simultaneous transmission of audio and video?
猜你喜欢

Nacos service registration and discovery

AI智能安防视频平台EasyCVR如何配置音视频同时传输?

(redistribute, special comprehensive experiment ospf area)

Process priority nice

Mini Program Graduation Works WeChat Points Mall Mini Program Graduation Design Finished Work (7) Interim Inspection Report

论坛管理系统

spicy(一)基本定义

OA Project Pending Meeting & History Meeting & All Meetings

Mini Program Graduation Works WeChat Second-hand Trading Mini Program Graduation Design Finished Work (2) Mini Program Function

Has been empty, a straightforward, continue to copy the top off!
随机推荐
Tcp编程
Operational configuration: How to run multiple EasyCVR programs as a service in one server?
Gateway routing gateway
FreeRTOS Personal Notes - Memory Management
小程序毕设作品之微信积分商城小程序毕业设计成品(7)中期检查报告
骁龙7系芯片表现如何?Reno8 Pro佐证新一代神U
Nacos namespace
论坛管理系统
Resampling a uniformly sampled signal
OA Project Pending Meeting & History Meeting & All Meetings
【转】Swift 中的面向协议编程:引言
小程序毕设作品之微信积分商城小程序毕业设计成品(4)开题报告
OpenFeign implementation downgrade
List获取差集产生的问题
Mini Program Graduation Works WeChat Points Mall Mini Program Graduation Design Finished Products (1) Development Overview
Mini Program Graduation Works WeChat Second-hand Trading Mini Program Graduation Design Finished Works (3) Background Functions
逆向分析实战2
监控页面部署
防抖与节流
How does the AI intelligent security video platform EasyCVR configure the simultaneous transmission of audio and video?