您當前的位置:首頁 > 動漫

1037. 有效的迴旋鏢

作者:由 蒺藜 發表于 動漫時間:2022-06-08

給定一個數組

points

,其中

points[i] = [xi, yi]

表示

X-Y

平面上的一個點,

如果這些點構成一個

迴旋鏢

則返回

true

迴旋鏢

定義為一組三個點,這些點

各不相同

不在一條直線上

def isBoomerang(self, points: List[List[int]]) -> bool:

return (points[1][0]-points[0][0])*(points[2][1]-points[0][1])!=(points[2][0]-points[0][0])*(points[1][1]-points[0][1])

太簡單,三點共線公式。

標簽: points  list  迴旋  xi  yi