LightOJ-1317 throwing Balls into the baskets

Source: Internet
Author: User

Description

You probably has played the game "throwing Balls into the basket". It's a simple game. You had to throw a ball into a basket from a certain distance. One day we (the Aiub Acmmer) were playing the game. But it is slightly different from the main game. In our game we wereNPeople trying to throw balls intoMIdentical baskets. At the turn we all were selecting a basket and trying to throw a ball into it. After the game we saw exactlySBalls were successful. Now you'll be given the value ofNandM. For each player probability of throwing a ball to any basket successfully areP. Assume that there be infinitely many balls and the probability of choosing a basket by any player is1/m.If multiple people choose a common basket and throw their ball, you can assume that their balls would not conflict, and the Probability remains same for getting inside a basket. You have to find the expected number of balls entered into the baskets afterKTurns.

Input

Input starts with an integer T (≤100), denoting the number of test cases.

Each case starts with a line containing three integers N (1≤n≤16), M (1≤m≤100) and K (0≤k≤100) and a real number p (0 p ≤1). P contains at most three places after the decimal point.

Output

For each case, print the case number and the expected number of balls. Errors less than 10-6 'll be ignored.

Sample Input

2

1 1 1 0.5

1 1 2 0.5

Sample Output

Case 1:0.5

Case 2:1

The main topic: There are n people, M basket box, K rounds, each round each person can cast a ball, each person's hit rate is the same p, ask K-round, the goal of the ball in the cast is how much this topic I think high school teacher said the answer is N*k*p; 10,000 6 drifting over

LightOJ-1317 throwing Balls into the baskets

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.