English, asked by harinimani791, 11 months ago

Maximum Integer at Xth Position
The program must accept N integers and an integer X as the input. The program must print all the integers such
that the integer in the Xth position is always maximum and the remaining integers are printed in descending order
as the output.
Boundary Condition(s):
2 <= N <= 1000
1 <= x <= N
UM
Input Format:
The first line contains N and X separated by a space.
The second line contains N integers separated by a space
Output Format:
The first line contains the N integers separated by a space based on the given conditions.
JEDNA
Example Input/Output 1:
Input:
53
55 10 25 47 73
Output:
55 47 73 25 10
Explanation:
The maximum integer value is 73 which is printed in the 3rd position.
The remaining integers are sorted in descending order as 55 47 25 10.
Hence the output is 55 47 73 25 10​

Answers

Answered by sujitharaj1099
8

Answer:

Explanation:

x=int(input())

y=int(input())

li=[]

for i in range(0,x):

   ele=int(input())

   li.append(ele)

print(i,end=" ")

li.sort(reverse==True)

u=max(li)

li.insert(y,u)

print(li,end=" ")

Similar questions