Accenture OA-27 2024
Problem Description
Mr. Professor is a great scientist, but he is not able to find a solution to one problem. There are N straight lines that are not parallel, and no three lines go through the same point. The lines divide the plane into M regions. Write a function to find out the maximum number of such regions he can get on the plane.
Input Format:
- The input consists of a single integer N representing the number of straight lines.
Output Format:
Output the maximum number of regions that can be formed by these lines.
Constraints:
- 1 ≤ N ≤ 10^9
Example
Sample Input:
3
Sample Output:
7
Explanation:
With 3 lines, the maximum number of regions that can be formed is 7.