Given number of cuts, find the maximum number of possible pieces.
This problem is nothing but The Lazy Caterer’s Problem and has below formula.
Maximum number of pieces = 1 + n*(n+1)/2
Refer this for proof.
# Python3 program to find maximum
# no. of pieces by given
# number of cuts
# Function for finding maximum
# pieces with n cuts.
return int(1 + n * (n + 1) / 2)
# Driver code
# This code is contributed 29AjayKumar
This article is contributed by DANISH_RAZA. If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
- Non-crossing lines to connect points in a circle
- Circle and Lattice Points
- Queries on count of points lie inside a circle
- Check whether a point exists in circle sector or not.
- Minimum lines to cover all points
- Program to find area of a circle
- Minimum revolutions to move center of a circle to a target
- Angular Sweep (Maximum points that can be enclosed in a circle of given radius)
- Number of Triangles that can be formed given a set of lines in Euclidean Plane
- Regular polygon using only 1s in a binary numbered circle
- Program for Point of Intersection of Two Lines
- Neighbors of a point on a circle using Bresenham's algorithm
- Count of obtuse angles in a circle with 'k' equidistant points between 2 given points
- Check whether given circle resides in boundary maintained by two other circles
- Check if a line touches or intersects a circle