due to double precision.

Your input

[[0, 0], [94911151, 94911150], [94911152, 94911151]]

Your answer

3

Expected answer

2

my code:

class Solution {

public:

int maxPoints(vector<Point> &points)

{

if (points.size()<3)

return points.size();

int result = 0;

unordered_map<double, int> slope_count;

```
for (int i = 0; i<points.size() - 1; i++)
{
slope_count.clear();
int samePointNum = 0; //与i重合的点
int point_max = 1; //和i共线的最大点数
for (int j = i + 1; j<points.size(); j++)
{
double slope; //斜率
if (points[i].x == points[j].x)
{
slope = std::numeric_limits<double>::infinity(); //防止重复元素没有斜率
if (points[i].y == points[j].y)
{
samePointNum++;
continue;
}
}
else
{
slope = 1.0*(points[i].y - points[j].y) / (points[i].x - points[j].x);
}
int count = 0;
if (slope_count.find(slope) != slope_count.end())
count = ++slope_count[slope];
else
{
count = 2;
slope_count[slope] = 2;
}
if (point_max<count)
point_max = count;
}
result = max(result, point_max + samePointNum);
}
return result;
}
```

};

can you help me?