Computer Science, asked by ayushinaskarr, 9 months ago

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 Examples Example 1 Input 3 10 20 30 Output 1.833333 Explanation: So all possible permutations are: {10 20 30} {10 30 20} {20} {10 30} {20 30} {10} {30} {10 20} {30 20} {10} So here there are total 6 permutations, and total number of groups are 11. So, output is 11/6 = 1.833333

Answers

Answered by preethudjp
0

Answer:

ge tv hdd ki fm pec sefgb bjw udbk na ks8e yks

Similar questions