F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

Candy Game

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)
Total Submission(s): 218    Accepted Submission(s): 115


Problem Description
Flora has many candies, which attract Preston. Flora told Preston "Let's play a game, after the game maybe you can get some candies."

Before the game starts, there is a piece of candy on the table.

Flora prepared a bag, there is $p$ balls in the bag, $q$ balls of them are sky-blue $(q < p)$, and the others are white.

The game will have $n$ rounds. The rule of each round is as follows:

Preston take out a ball from the bag, and write down its color, **then put it back into the bag.**

We assume that **the possibility of taking out every ball is equal.**

If the ball is blue, Flora will add a piece of candy on the table.

Otherwise, Flora will put all candies on the table into **a new box**, then put a new piece of candy on the table.

After n rounds, Flora put all candies on the table into **a new box**.

Flora told Preston , "you can choose a box,and eat all candies in it".

Of course, Preston will choose the box which has the most candies in it.

Now Preston wants to know the expectation of the number of candies he could eat.
 

Input
The input consists of multiple testcases.

There is an positive integer $T$ in the first line standing for the number of the testcases.

Next $T$ lines, each line contains $3$ integers $n,p,q$.

$1 \leq T \leq 10$

$1 \leq n \leq 1500$

$1 \leq q < p \leq 10^5$
 

Output
For each testcase, output one line, the expectation of the number of candies he could eat.

The output number should be rounded to $3$ decimal places.
 

Sample Input
2 1 2 1 2 2 1
 

Sample Output
1.500 2.000
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-11-26 13:06:23, Gzip enabled