标签:
水题但是WA2发了,要特别考虑斜率不存在的情况,最后的答案就是斜率不同的数目,set一下
#include<cstdio>
#include<cstring>
#include <iostream>
#include<queue>
#include <cmath>
#include <set>
using namespace std;
const int maxn=65000+10;
const int INF=1<<30;
typedef long long LL;
int main()
{
#ifdef xxz
freopen("in.txt","r",stdin);
#endif // xxz
int n;
int x0,y0;
while(cin>>n>>x0>>y0)
{
set<double> s;
for(int i = 0; i < n; i++)
{
int x1,y1;
double k;
cin>>x1>>y1;
if(x1 - x0 == 0) s.insert(999999999999.0333);
else
{
k =(y1 - y0)*1.0/(x1 - x0);
s.insert(k);
}
}
cout<<s.size()<<endl;
}
return 0;
}Codeforces Round #291 (Div. 2)(B)
标签:
原文地址:http://blog.csdn.net/u013445530/article/details/43844313