문제1628--Betting Sets

### 1628: Betting Sets

실행시간 제한: 10 Sec  메모리사용 제한: 256 MB
제출: 16  통과: 7
[제출] [채점기록] [묻고답하기]

#### 문제 설명

Your local casino (which here in California is a fair distance away) has decided to try out a new betting game. The player is given a table on a card with N rows and M columns. Each entry ij of the table corresponds to a coin ﬂip with a probability pij of coming up heads. All the coin ﬂips are independent of each other. The player must choose N sets of M entries, with each set having exactly one entry from each column, and each entry being used exactly once. For each chosen set where all M coins come up heads, the player wins 1 dollar. The casino is feeling uncharacteristically generous, and so as part of the promotion of this new game, they have been handing out one card to each patron. Since you have nothing to lose, you’re going to give this game a shot. How can you maximize your expected winnings from this card?

#### 입력 설명

The input consists of multiple test cases. Each test case begins with a line with two integers N and M, 1 ≤ N ≤ 100, 1 ≤ M ≤ 10, separated by a space. This is followed by N lines with M space-separated numbers each, denoting the entries pij of the table. Input is followed by a single line with N = M = 0, which should not be processed.

#### 출력 설명

For each test case, print out a single line with the maximum expected winnings from the given table, accurate to 4 decimal places.

#### 입력 예시 Copy

2 3
1.0 1.0 1.0
0.5 0.4 0.3
0 0

#### 출력 예시 Copy

1.0600