#P16249. [蓝桥杯 2026 省研究生组] 评测漏洞
[蓝桥杯 2026 省研究生组] 评测漏洞
Problem Description
"The judge is stuck again!" Xiao Lan frowned and stared at the evaluation error log on the screen.
After careful investigation, he found a hidden vulnerability in the checking logic of the judging system: when the system reads two parameters and in order, if the combination of these two numbers satisfies a certain arithmetic property, it will cause a memory overflow and then trigger an abnormal termination.
Specifically, if two parameters that appear in order, and (where ), satisfy the following equation, the system will crash:
$$\begin{aligned} (a_i + a_j)^2 = a_i + a_j \end{aligned}$$To fix this vulnerability, Xiao Lan exported all test parameters from the current crashing testdata, and arranged them in the input order as . Now he needs you to help count how many index pairs in this sequence satisfy and will trigger the above exception.
Input Format
The first line contains an integer , which represents the total number of test parameters.
The second line contains integers , which represent the parameter values read in order.
Output Format
Output one integer, which represents the number of parameter pairs that can trigger the exception.
4
-1 0 1 2
3
Hint
Constraints and Notes
For of the test cases, .
For all test cases, , .
Translated by ChatGPT 5