Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <cstdio>
- #include <cmath>
- #include <vector>
- #include <map>
- using namespace std;
- #define X first
- #define Y second
- int main() {
- freopen("1.txt", "r", stdin);
- int n,r=0;
- scanf("%d", &n);
- vector<pair<int,int> > a(n);
- for(int i=0; i<n; i++)
- scanf("%d%d", &a[i].X, &a[i].Y);
- double k;
- map<double, int>::iterator it;
- for(int i=0; i<n; i++) {
- map<double, int> m;
- for(int j=0; j<i; j++) {
- if(a[i].Y == a[j].Y) k = 0.; else
- if(a[i].X == a[j].X) k = ~(1<<31); else
- k = (double)(a[j].Y-a[i].Y)/(double)(a[j].X-a[i].X);
- m[k]++;
- }
- for(it = m.begin(); it!=m.end(); it++)
- r += (it->second+1)*max(it->second-1,0);
- }
- printf("%d\n", r);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement