-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path1027.最长等差数列.java
61 lines (47 loc) · 1.11 KB
/
1027.最长等差数列.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/*
* @lc app=leetcode.cn id=1027 lang=java
*
* [1027] 最长等差数列
*/
// @lc code=start
class Solution {
public boolean isBoomerang(int[][] points) {
int x1=points[0][0];
int y1=points[0][1];
int x2=points[1][0];
int y2=points[1][1];
int x3=points[2][0];
int y3=points[2][1];
// 两点为同一点
if(x1==x2&&y1==y2){
return false;
}
if(x1==x3&&y1==y3){
return false;
}
if(x2==x3&&y2==y3){
return false;
}
if(x2==x1){
if(x3==x1){
return false;
}else{
return true;
}
}
if(x3==x1){
if(x2==x1){
return false;
}else{
return true;
}
}
float a = (float) (y2-y1)/(x2-x1);
float b = (float) (y3-y1)/(x3-x1);
if(a==b){
return false;
}
return true;
}
}
// @lc code=end