#P16483. [GKS 2014 #B] New Years Eve
[GKS 2014 #B] New Years Eve
题目描述
At new years party there is a pyramidal arrangement of glasses for wine. For example, at the top level, there would just be one glass, at the second level there would be three, then and then and so on and so forth like the following image:
:::align{center}
:::
The glasses are numbered using numbers, and . represents the level of the glass and represents the number in that level. Numbers in a given level are as follows:
Level 1:
1
Level 2:
1
2 3
Level 3:
1
2 3
4 5 6
Level 4:
1
2 3
4 5 6
7 8 9 10
Each glass can hold ml of wine. The bartender comes and starts pouring wine in the top glass(The glass numbered and ) from bottles each of capacity ml.
As wine is poured in the glasses, once a glass gets full, it overflows equally into the glasses on the next level below it and touching it, without any wine being spilled outside. It doesn't overflow to the glasses on the same level beside it. It also doesn't overflow to the any level below next level (directly).
For example: When the glass of and overflows, the water will overflow to glasses of
and , , .
Once that the bartender is done pouring bottles, figure out how much quantity in ml of wine is present in the glass on level with glass number .
输入格式
The first line of the input gives the number of test cases, . test cases follow. Each test case consists of three integers, , , . is the number of bottles the bartender pours and is the glass level in the pyramid and is the number of the glass in that level.
输出格式
For each test case, output one line containing "Case #x: y", where is the test case number (starting from ) and is the quantity of wine in ml in that glass.
We recommend outputting to decimal places, but it is not required. will be considered correct if it is close enough to the correct number: within an absolute or relative error of .
7
1 2 1
1 1 1
2 1 1
20 1 1
1 3 1
2 3 1
10 4 10
Case #1: 166.6666667
Case #2: 250.0000000
Case #3: 250.0000000
Case #4: 250.0000000
Case #5: 0.0000000
Case #6: 55.5555556
Case #7: 157.4074074
提示
Limits
.
Small dataset (Test set 1 - Visible)
.
.
$1 \le N \le \text{Number of glasses on the corresponding level}$.
Large dataset (Test set 2 - Hidden)
.
.
$1 \le N \le \text{Number of glasses on the corresponding level}$.