Remember My Name
All submissions for this problem are available.
"Remember My Name" says Walter White on Breaking Bad's Imposing Final Poster. He also wants everyone to remember his name in the reel and real life both. The easiest way of getting his wish fulfilled is to become a Legendary Coder. So, he starts practicing.
Now he is facing a problem in getting to a solution of the following problem. Please help him to solve it.You are given an integer m. Choose m points in the Cartesian plane (x-y plane) and construct all the lines possible by joining all pairs of m points. The points should be placed such that no two lines constructed are parallel and no three lines are concurrent at some point other than the chosen m points. Please see sample input for better understanding.
Your task is to find out the number of point of intersection of these constructed lines( lines can be extended infinitely ) excluding the m points taken initially. Print the answer modulo 10^9+7.
The first line of input contains T, denoting the number of test cases. Next T lines will each containing a number m denoting the number of points in the Cartesian Plane (x-y plane).
For each test case, output a single number in a new line denoting the number of points of intersection of lines other than the given points modulo 10^9+7.
- 1 ≤ T ≤ 10^5
- 1 ≤ m ≤ 10^18
Input: 2 4 7 Output: 3 105
Example case 1.
Let the points be 1,2,3 and 4 . The points A,B and C represent the intersection points that contribute to the answer . So answer = 3
|Time Limit:||1 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.6, PYPY|
Fetching successful submissions