You are given a polygon of \(N\) sides with vertices numbered from \(1,\ 2,\ ...,\ N\). Now, exactly \(2\) vertices of the polygons are colored black and remaining are colored white. You are required to find the number of triangles denoted by \(A\) such that:
- The triangle is formed by joining only the white-colored vertices of the polygon.
- The triangle shares at least one side with the polygon.
Input format
- The first line contains \(t\) denoting the number of test cases.
- Next \(t\) lines contain three space-separated integers \(N\), \(B1\), and \(B2\) where \(N\) is the number of sides in the polygon and \(B1, B2\) denote the vertices that are colored black.
Output format
For each test case, print the answer \(A\) representing the number of triangles that can be formed with the given conditions in the problem statement.
Constraints
\(1 \le t \le 100\)
\(5\le N \le10^5\)
\(1\le B1, B2 \le N\)
The number of triangles which satisfy the property are 4 - \(\triangle\)136 , \(\triangle\)146 , \(\triangle\)346 and \(\triangle\)134
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor
Login to unlock the editorial
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor