blablabla
直接用所有的点与激光枪的位置求一个斜率就行了 用unordered_set去存,还要记得斜率是double类型,分母为0时便不用存,最后加一就好了。
include [HTML_REMOVED]
include [HTML_REMOVED]
include [HTML_REMOVED]
include [HTML_REMOVED]
using namespace std;
int n, x, y;
int main()
{
ios::sync_with_stdio(0);
cin >> n >> x >> y;
unordered_set[HTML_REMOVED] sett;
bool is_exist = false;
while (n -- )
{
int a, b;
cin >> a >> b;
if(a == x)
{
is_exist = true;
continue;
}
double k = (b - y) * 1.0 / (a - x);
sett.insert(k);
}
if (is_exist) cout << sett.size() + 1 << endl;
else cout << sett.size() << endl;
return 0;
}