include iostream include vector include cmath using namespace std stru

 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
#include <iostream>
#include <vector>
#include <cmath>
using namespace std;
struct Point
{
int x;
int y;
};
int vect_prod(Point p1, Point p2, Point p)
{
return (p2.x - p1.x)*(p.y - p1.y) - (p2.y-p1.y)*(p.x- p1.x);
}
int main()
{
int t;
cin >> t;
for(int i = 0; i < t; i++)
{
int n;
cin >> n;
vector<Point> v;
for(int j = 0; j < n; j++)
{
Point a;
cin >> a.x >> a.y;
v.push_back(a);
}
int count = 0;
for(int m = 0; m < n; m++)
{
for(int j = m+1; j < n; j++)
{
for(int k = j+1; k < n; k++)
{
if(vect_prod(v[m], v[j], v[k]) == 0)
count++;
}
}
}
cout << count << endl;
}
}