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
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
This article is attributed to GeeksforGeeks.org