A Two Card Game
Practice
2.2 (8 votes)
Approved
Probability distribution
Easy
Mathematics
Open
Probability and statistics
Probability distribution
Problem
20% Success 6420 Attempts 20 Points 1s Time Limit 256MB Memory 1024 KB Max Code

Maggu and Maggie likes to play a simple card game. Game goes this way: Given n cards each containing a number.In one go, any one of them picks up one card from the n cards and then second one picks up one card from the remaining cards. The card holder having card containing greater number will win the game.

Rather than playing game ,maggu thinks of calculating his winning or loosing probability. Help him as he is not good at mathematics.

NOTE: A game is only lost by a player when it is won by other player .

INPUT:
first line of input contains a single integer n denoting the number of cards.Next line of input contains n space separated integers denoting number on each card.

OUTPUT:
output consists of one line only containing two space separated real numbers denoting the winning and loosing probability of maggu.

CONSTRAINTS:
n<=10^6
A[i]<=10^6

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:20
3 votes
Tags:
ImplementationProbability and StatisticsProbability distributionEasyMathematicsapprovedProbability distribution