Finding the probability of winning the tennis game Mark plays best when it's sunny. Mark wins a set with probability P(s) when it's sunny, and with probability P(r) when it's raining. The chance that there will be sun for the first set is P(i). Luckily for mark, whenever he wins a set, the probability that there will be sun increases by P(u) with probability P(w). Unfortunately, when mark loses a set, the probability of sun decreases by p(d) with probability p(l). What is the chance that mark will be successful in his match?
You'll be given number of sets(N). 
I have no clue about how to solve it ! What are the things i need to study to solve these types of problems.And please suggest a solution by explaining in simple terms :) 
Testcase :
Number of sets=1 
P(s)=0.800 
P(r)=0.100 
P(i)=0.500 
P(u)=0.500 
P(w)=0.500 
P(d)=0.500 
P(l)=0.500
Chance that he'll win= 0.450000
Source: This is a programming contest problem....
 A: You didn't specify if the match is first to win two or first to win three.  I will assume two and start, but the same approach works (with more work) for three.  He can win the set in three ways:  win the first two games, win-lose-win, or lose-win-win.  The chance that he wins the first game is $P(i)P(s)+(1-P(i))P(r)$.  The first term is the chance that it is sunny and he wins, the second is the chance it is raining and he wins.  In your sentence, "whenever he wins a set, the probability that there will be sun increases by P(u) with probability P(w)" it is not clear what happens if the $P(w)$ does not occur.  I will assume that the chance of sun does not change.  Now if he wins the first game, the chance of sun is $P(i)+P(w)P(u)$, so the chance of winning is $(P(i)+P(w)P(u))P(s)+(1-(P(i)+P(w)P(u))P(r)$ with the same logic as above.  You need to keep chasing through the possibilities, accumulating the probabilities until you are done.
Added:  You are building a tree.  For each set, there are four possibilities:  win with P(i) changing, win with no change, lose with P(i) changing, lose with no change.  After $n$ sets you have $n+1$ possibilities for how many sets he has won and for each one you have $n$ possibilities for the number of up and down changes in P(i).  You can calculate the chance of each of these following the idea above.
