Furude_Rika is so boring so she plays a game with herself.

She has a matrix consisting m rows and n columns and all of its element are "1"s.

In each second she can choose one element with equal probility.

if it is "1",she will change it to "0",otherwise she ignore it.

If there is at least one "0" on each row and at least one "0" on each column,the game ends.

Furude_Rika wants to calculate the expected time needed to finish this game.

As she is only a little girl,can you help her?

## 问题 B: Furude_Rika and game

时间限制: 1 Sec 内存限制: 128 MB提交: 21 解决: 12

[提交][状态][讨论版]

## 题目描述

## 输入

The first line contains an integer T, indicates the number of test case. (T<=15)

Next T lines contains two integers m and n,indicates the number of rows and the number of lines.(m<=2000,n<=2000)

## 输出

For each test case, output one line, the expected time needed to finish this game.

The answer is round to three digit.

## 样例输入

```
3
1 1
1 2
2 2
```

## 样例输出

```
1.000
3.000
3.667
```

## 提示

for m=1,n=2.

the expect time is:1*0+2*1/2+3*1/4+4*1/8+5*1/16+……=3.000

한국어
中文
فارسی
English
ไทย

Anything about the Problems, Please Contact Admin:admin

All Copyright Reserved 2010-2014 Xidian ACM Online Judge TEAM

GPL2.0 2003-2014 HUSTOJ Project TEAM

Anything about the Problems, Please Contact Admin:admin

All Copyright Reserved 2010-2014 Xidian ACM Online Judge TEAM

GPL2.0 2003-2014 HUSTOJ Project TEAM