wants to buy a necklace in which
1. There is a minimum of 1 pearl and maximum of X pearls, such that each pearl
has its own magnificent coefficient.
2. The pearls should be in non-decreasing order of their magnificence power
You are given the maximum number of pearls in a necklace and the range of the magnificent coefficients of the pearls Find the number of necklaces that can be made that follow the mentioned conditions
Input Specificatione
input1: Maximum number of pearls that can be used to form the necklace
input2: Starting magniliomt coefficient of pearls
input3: Ending magnificent coefficient of pearls
Output Specification
Retum the number of necklace options possible as per given conditions
N=int(input("Maximum number of pearls that can be used to form the necklace: "))
x=int(input("Starting magniliomt coefficient of pearls: "))
s=int(input("Ending magnificent coefficient of pearls: "))
count = N-1
for i in range(N - 1, 0, -1):
  print(1, N, i, "")
print("The count is : ", count)
p=0
if (x == 0):
  for i in range(N - 1, s, -1):
   print(p + i);
   count+=1;
else:
  for i in range(N - x, s, -1):
    print(i + 1, n, x - 1, p + i + " ")
  Â
Comments
Leave a comment