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
|
#include <cstdlib> #include <algorithm> #include <cstring> #include <cctype> #define INF 2000000000 using namespace std; typedef long long ll; int (){ int f=1,x=0;char c=getchar(); while(c<'0'||c>'9'){if(c=='-')f=-f;c=getchar();} while(c>='0'&&c<='9')x=x*10+c-'0',c=getchar(); return f*x; } int n,x[205],y[205],tot=0; double lis[40005],eps=1e-8; double slope(int a,int b){ if(x[a]==x[b])return 1e9; return (double)(y[b]-y[a])/(x[b]-x[a]); } int cmp(double a,double b){ return (a-b)>-eps&&(a-b)<eps; } void init(){ n=read(); for(int i=1;i<=n;i++)x[i]=read(),y[i]=read(); } void solve(){ for(int i=1;i<=n;i++) for(int j=1;j<i;j++) lis[++tot]=slope(i,j); sort(lis+1,lis+tot+1); int ans=0; for(int i=2;i<=tot;i++){ while(cmp(lis[i],lis[i-1])&&i<=tot) i++; ans++; } if(!cmp(lis[tot],lis[tot-1]))ans++; printf("%dn",ans); } int main(){ init(); solve(); return 0; }
|
近期评论