fork download
  1. #include<iostream>
  2. #include<cstdio>
  3. #include<cstring>
  4. #include<set>
  5. using namespace std;
  6.  
  7. struct self{int x,y;}s[40044];
  8. int m,a,b,c,z;
  9. set<double>q;
  10. bool zero=0;
  11.  
  12. bool ok(int x1,int y1,int x2,int y2)
  13. {
  14. int x=x1-x2;
  15. int y=y1-y2;
  16. if(x==0)
  17. {
  18. if(!zero)
  19. {
  20. zero=1;
  21. return true;
  22. }
  23. return false;
  24. }
  25. if(q.insert(double(y)/x).second)return true;
  26. return false;
  27. }
  28.  
  29.  
  30. int main()
  31. {
  32. scanf("%d",&m);
  33. for(a=1;a<=m;a++)scanf("%d%d",&s[a].x,&s[a].y);
  34.  
  35. for(a=1;a<=m;a++)
  36. for(b=a+1;b<=m;b++)
  37. if(ok(s[a].x,s[a].y,s[b].x,s[b].y))z++;
  38.  
  39. cout<<z<<'\n';
  40. return 0;
  41. }
Success #stdin #stdout 0s 3788KB
stdin
4
-1 1
-2 0
0 0
1 1
0
stdout
4