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

ATM Mechine

Time Limit: 6000/3000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)
Total Submission(s): 1926    Accepted Submission(s): 967


Problem Description
Alice is going to take all her savings out of the ATM(Automatic Teller Machine). Alice forget how many deposit she has, and this strange ATM doesn't support query deposit. The only information Alice knows about her deposit is the upper bound is K RMB(that means Alice's deposit x is a random integer between 0 and K (inclusively)).
Every time Alice can try to take some money y out of the ATM. if her deposit is not small than y, ATM will give Alice y RMB immediately. But if her deposit is small than y, Alice will receive a warning from the ATM.
If Alice has been warning more then W times, she will be taken away by the police as a thief.
Alice hopes to operate as few times as possible.
As Alice is clever enough, she always take the best strategy.
Please calculate the expectation times that Alice takes all her savings out of the ATM and goes home, and not be taken away by the police.
 

Input
The input contains multiple test cases.
Each test case contains two numbers K and W.
$1 \leq K,W \leq 2000$
 

Output
For each test case output the answer, rounded to 6 decimal places.
 

Sample Input
1 1 4 2 20 3
 

Sample Output
1.000000 2.400000 4.523810
 

Author
ZSTU
 

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-04-25 20:58:58, Gzip enabled