# class Point:
# def __init__(self, a=0, b=0):
# self.x = a
# self.y = b
#
#
# @param points Point类一维数组
# @return int整型
#
class Solution:
def maxPoints(self , points ):
# write code here
le = len(points)
if le<3:
return le
num = 0
for i in range(le-1):
for j in range(i+1, le):
k1 = (points[i].y - points[j].y)
k2 = (points[i].x - points[j].x)
if k1 == 0: # 水平线
nu = [1 for ik in points if ik.y == points[i].y]
elif k2 == 0: # 竖直线
nu = [1 for ik in points if ik.x == points[i].x]
else: # 斜线
x = points[i].x
y = points[i].y
# 注意:if逻辑判断中应避免除法的影响
nu = [1 for ik in points if k2 * (ik.y - y) == k1 * (ik.x - x)]
num = max(num, len(nu))
return num