Computer Science, asked by meenavsp11, 2 days ago

N
3
Steffan and friends have set out on a vacation
to Coorg. They have booked accommodation in
a resort and the resort authorities organize
Camp fires every night as a part of their daily
activities. Steffan volunteered himself for an
activity called the "Adjacent Stick Game
where sticks of different length will be placed
in a line and Steffan needs to remove a stick
from each adjacent pair of sticks. He then has
to form a bigger stick by combining all the
remaining sticks.
4
5
6
7
Steffan needs to know the smallest length of
the bigger stick so formed and needs your help
to compute the same. Given the number of
sticks N and the lengths of each of the sticks.
write a program to find the smallest length of
the bigger stick that is formed.
8​

Answers

Answered by sundrideswal
3

Answer:

sign up to puri tarah se sune v samajhe a comb through the quiz mam please find the attached file is scanned image to enlarge image to enlarge image to enlarge image to enlarge

Answered by choyon
3

Answer:

values=[]

minimum=[]

minimum_values=[]

i=0

n = int(input("enter n\n"))  # here only five inputs taken from user

arr = list(map(int, input().split()[:n]))

while i<=n:

   for element in arr[i:i+2]:

       values.append(element)

       minimum=min(values)

   minimum_values.append(minimum)

   i=i+2

   values=[]

length=len(minimum_values)

minimum_values=minimum_values[:length-1]

print(sum(minimum_values))

   

Explanation:

Similar questions