current position:Home>Use C + + to complete the magic array applet

Use C + + to complete the magic array applet

2022-01-27 01:16:55 CSDN Q & A

Title Description :
There is a circular wide array , On the circumference of the circular normal matrix N A little bit , When four different points on the circumference of the normal matrix can just form a rectangle , Normal array can produce 1 Unit energy .( If Zhizhi has a different node , It is considered that the two rectangles are different , The same point can be counted into multiple rectangles .)
Now? , It is known that the arc length between two adjacent points is a positive integer , The arc length between two adjacent points is given in the order starting from a certain point , Find out how much unit energy this normal array can produce .
Input format :
The first line is an integer N
Next N That's ok , One integer per row , Respectively represent the arc length divided between two adjacent points .
Output format :
An integer , Represents the energy generated by the normal array .
sample input :

sample output :
Data range and tips :
about 40% The data of , Satisfy N<=20
about 70% The data of , Satisfy N<=5000
about 100% The data of , Satisfy N<=200000

Refer to the answer 1:

Hint , If you want to be rectangular , His diagonal must pass through the center of the circle , That is to say, it must be a half circle from the starting point to the diagonal point .

Refer to the answer 2:

copyright notice
author[CSDN Q & A],Please bring the original link to reprint, thank you.

Random recommended