# 1037.Valid Boomerang

**1037.Valid Boomerang**

难度:Easy

> A boomerang is a set of 3 points that are all distinct and not in a straight line.

Given a list of three points in the plane, return whether these points are a boomerang.

```
Example 1:

Input: [[1,1],[2,3],[3,2]]
Output: true
Example 2:

Input: [[1,1],[2,2],[3,3]]
Output: false
 

Note:

points.length == 3
points[i].length == 2
0 <= points[i][j] <= 100
```

三点共线是斜率的比较，可以直接采用一次方程通用公式，也可以直接比较斜率，注意一下特殊情况即可。

```
class Solution {
public:
    bool isBoomerang(vector<vector<int>>& points) {
        int a=points[1][1]-points[0][1];
        int b=points[1][0]-points[0][0];
        int c=points[2][1]- points[0][1];
        int d=points[2][0]-points[0][0];
      //  cout<<a<<" "<<b<<" "<<c<<" " << d<<endl;
        if(b && d)
        return a/float(b)!=c/float(d);
        else if(b)
            return c;
        else if (d)
            return a;
        else
            return false;
    }
};
```

> 执行用时 :4 ms, 在所有 C++ 提交中击败了92.14%的用户\
> 内存消耗 :8.2 MB, 在所有 C++ 提交中击败了100.00%的用户


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://dfine.gitbook.io/leetcode/1037.valid_boomerang.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
