luogu#P9423. [蓝桥杯 2023 国 B] 数三角

[蓝桥杯 2023 国 B] 数三角

Problem Description

Xiaoming places nn points on a 2D coordinate plane. He wants to choose a subset of three points that can form a triangle. However, there are too many such choices, so he decides to only count those that can form an isosceles triangle. Please help him compute how many different ways to choose three points can form an isosceles triangle.

Input Format

The input has n+1n + 1 lines.

The first line contains a positive integer nn.

The next nn lines each contain two integers xi,yix_i, y_i, representing the coordinates of the ii-th point.

Output Format

Output one line containing one integer.

5
1 4
1 0
2 1
1 2
0 1
5

Hint

Sample Explanation

There are 55 ways in total: {2,3,4}\{2,3,4\}, {3,4,5}\{3,4,5\}, {4,5,2}\{4,5,2\}, {5,2,3}\{5,2,3\}, {1,3,5}\{1,3,5\}.

Test Case Scale and Assumptions

  • For 20%20\% of the testdata, it is guaranteed that n200n \le 200.
  • For 100%100\% of the testdata, it is guaranteed that n2000n \le 2000, 0xi,yi1090 \le x_i, y_i \le 10^9.

The 14th Lanqiao Cup Software Competition Finals, C/C++ University Group B, Problem E.

Translated by ChatGPT 5