Table of Contents
Problem Statement 11 : Asked on [02/2024]
Chocolate Distribution
You have a total of n chocolates that you want to distribute between two individuals, A and B. However, there are specific conditions for the distribution:
- Person A must receive more chocolates, than person B.
- Person B must receive at least one chocolate.
Write a function chocolate_distribution_ways(n) that takes an integer n as input and returns the number of distinct ways you can distribute the chocolates between A and B, satisfying the given conditions.
Input
n (1 <= n <= 100): An integer representing the total number of chocolates.
Output
Returns an integer representing the number of distinct ways the chocolates can be distributed.
Example
chocolate_distribution_ways(4) # Returns 1 chocolate_distribution_ways(12) # Returns 5
Explanation
a, b
For 4 chocolates: (5, 1), is the valid distributions.
For 6 chocolates: (11,1), (10,2), (9, 3), (8, 4), (7, 5) are the valid distributions.