[Huawei OD Unified Exam B Paper | 200 points] The number of squares (C++ solution version)

Instructions for the new question bank of Huawei OD Unified Examination A + B

In May 2023, Huawei officially revised the 2022/0223Q (1/2/3/4) to OD unified examination (A paper) and OD unified examination (B paper).
The link you receive will be marked with A roll or B roll. Please note: According to the feedback, most of the current ones received are B rolls. But there is still a chance to get the A roll.
Paper A corresponds to the new question bank of 2023 (2022Q4 20223Q1) Paper B corresponds to some of the 20022 exam questions and new questions

Column: 2023 Huawei OD machine test (A volume + B volume) (C++JavaJSPy)

topic description

Input N different two-dimensional integer coordinates, find the number of squares that can be formed by these N coordinates. [two vectors whose inner product is zero are perpendicular]

enter description

The input in the first line is N, N represents the number of coordinates, and N is a positive integer. N <= 100

The following K lines are input as coordinates xy separated by spaces, x and y are integers, -10<=x, y<=10

output description

Output the number of squares that can be formed.

ACM input and output mode

If you often use Leetcode , you will know that letcode does not need to write input and output functions. However, the Huawei OD machine test uses the ACM mode , which requires manual programming of input and output.

So it's better to be on Niu-ke

Guess you like

Origin blog.csdn.net/banxia_frontend/article/details/131159861