User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Community Introductions section within the Coffee House category of DaniWeb, a massive community of 423,789 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,700 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Community Introductions advertiser: Programming Forums

I need Help..plz Solve this problem!!!

Join Date: May 2008
Posts: 14
Reputation: usmanabb is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 0
usmanabb usmanabb is offline Offline
Newbie Poster

I need Help..plz Solve this problem!!!

  #1  
May 10th, 2008
Recently, there was an international volleyball championship. Speaking of volleyball, we are interested in the probability of winning of one or another team, if we know some information about the teams. Here are the rules of the game and the necessary information:

the match is played by two teams: A and B;

the first team to win K games in a match, wins the match;

each game consists of rounds; each round is won by one of the teams, and the team adds one point to its score for the current game;

the first team to win L points in a game, wins the game;

if team A serves the ball in a round, it has Pa% chance to win the round (and (100-Pa)% to loose it);

if team B serves the ball in a round, it has Pb% chance to win the round (and (100-Pb)% to loose it);

if a round is not the first in a game, the ball in the round is served by the team that won the last round;

if a game is not the first in a match, the ball in the first round of the game is served by the team that did not served the ball in the first round of the previous game;

both teams have an equal chance to serve the ball in the first round of the very first game of a match.

So, for given values of Pa, Pb, K, and L, you have to compute the probability, as a percent, for team A to win the match.


Input

There is one number in the first line - the number of data sets. Each data set consists of a single line with four integers on it: Pa, Pb, K, and L (1 <= K <= 100, 1 <= L <= 100).


Output

For each test you must write on one line the required result with exactly one digit after the decimal point (the number should be rounded to the first digit after the decimal point).


Sample Input

2
100 50 1 3
100 1 1 1


Sample Output

93.8
99.5

Plz use simple programming im just a beginner if (simple) not possible then plz do it anyway!!
Thankyou very much!!!
AddThis Social Bookmark Button
Reply With Quote  
All times are GMT -4. The time now is 2:32 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC