Computer Science, asked by shekharsaini7898, 7 months ago

Single Lane Highway Problem Description Certain number of cars are passing a single lane road. Speeds of all cars vary. It is easy to see, that depending on the speeds of the cars various groups will be formed. Being a single lane road passing/overtaking is not allowed. Given speeds of cars, calculate how many groups can be formed if all possible permutations are taken into account. Refer example1 for better understanding. Print number of groups divided by the number of permutations. Constraints 0 <= N < 10 ^ 5 0 <= speed of individual vehicle < 10 ^ 9 Input First line contains an integer N, which denotes the number of vehicles Second line contains N space separated integers which denotes the speed of individual vehicle. Output Print number of groups divided by the number of permutations rounded upto 6 decimal places. Time Limit 1

Answers

Answered by lalb24934
80

Answer:

hy dear plz follow me dear

Answered by raghav81cse17
2

Answer:

   n=int(input())

   L=map(int,input().split())

   sum=0

   for i in range(1,n+1):

       sum+=1/i

   

   print("{0:.6f}".format(sum))

Explanation:

permutations(p)=n!

number of groups(q)=n!(1/1+1/2+1/3.....+1/n) it is equivalent to n!(logn)

so, q/p=E(i=1 to n) 1/i .

This is a question related to Group theory, Linearity of Expectations and Permutations.

Similar questions