## King Graff's Defense

King Graff, the ruler of the land of Feerie, has a problem - his nation is under attack! Luckily, he has an army at his disposal, composed of a whopping `S` soldiers (where `S` = 2).

Feerie consists of `N` (1 ≤ `N` ≤ 10^{6}) towns (numbered 1..`N`), and `M` (1 ≤ `M` ≤ 10^{6}) roads. The `i`-th road runs between distinct towns `A _{i}` and

`B`, in both directions. No pair of towns is directly connected by more than one road, but every pair of towns is connected by at least one path of connected roads. King Graff would like to position his two soldiers in two different towns to prepare for the impending assault - however, since he's not much of a strategist, he'll choose the towns at complete random.

_{i}Graff's only real concern is with his enemies using a divide-and-conquer strategy. His soldiers will be susceptible to this type of attack if there exists any single road that, if blocked, will prevent them from reaching each other by any system of connected roads. As the royal computer scientist, your job is to determine the probability that King Graff will be defeated.

### Input

Line 1: 2 integers, `N` and `M`

Next `M` lines: 2 integers, `A _{i}` and

`B`, for

_{i}`i`= 1..

`M`

### Output

Line 1: 1 real number (rounded to 5 decimal places), the probability that the two towns chosen by Graff can be disconnected by the removal of any single road

### Sample Input

4 4 1 2 1 3 2 4 4 1

### Sample Output

0.50000

### Explanation of Sample

The map of Feerie is illustrated below:

King Graff can make 6 possible choices as to where to place his soldiers, and three of those (the three with one of the soldiers being at town 3) result in defeat (if the road between towns 1 and 3 is destroyed). The probability of failure is then 3/6 = 0.5.

All Submissions

Best Solutions

**Point Value:** 15 (partial)

**Time Limit:** 3.00s

**Memory Limit:** 64M

**Added:** Sep 12, 2012

**Author:** SourSpinach

**Languages Allowed:**

C++03, PAS, C, HASK, ASM, RUBY, PYTH2, JAVA, TEXT, PHP, SCM, CAML, PERL, C#, C++11, PYTH3

## Comments (Search)

spencereiron Nov 30, 2015 - 11:05:33 pm UTC Any tips for doing this problem offline?Thanks!

XIAOAGEon Dec 01, 2015 - 2:02:29 pm UTC Re: Any tips for doing this problem offline?bbi5291on Dec 02, 2015 - 8:49:53 pm UTC Re: Any tips for doing this problem offline?spencereiron Dec 03, 2015 - 12:01:34 am UTC Re: Any tips for doing this problem offline?bbi5291on Dec 09, 2015 - 6:26:56 am UTC Re: Any tips for doing this problem offline?