# DCP-21: BAN vs IND Back to All Problems

Medium Divide and Conquer > Dynamic Programming

India is going to tour Bangladesh in the next month. The two great rivals are going to face each other in Bangladesh in the month of June. They will play **2M − 1** matches in the upcoming series. All of you know the terrible event happened in the recent World Cup. So, Bangladesh will try to give real fight to the Indians. The team winning **M** matches will be the series champion. The result of each game doesn’t depend on the rest. And we are considering that there won’t be any draw/abandon in a match. What is the probability of Bangladesh to win the series? Input: ------ The first line of the input contains an integer, T, representing the number of test cases **(1 ≤ T ≤ 1000)**. For each test case, two numbers separated by space, the first one contains a number **M, 1 ≤ M ≤ 50**, representing the number of wins Bangladesh has to reach. The second one contains a number **p, 0 ≤ p ≤ 1**, representing the probability of Bangladesh to win a single match. Output: ------- For each test case the output should contain a single line with the case number and followed by the number representing the probability of Bangladesh to win the series (Print up to three decimal places). Sample Input ------------ 4 10 0.7 30 0.6 30 0.4 7 0.9 Sample Output ------------- Case 1: 0.967 Case 2: 0.940 Case 3: 0.060 Case 4: 1.000

### Problem Limits

 Language Time Limit (seconds) C 1.00 C++ 1.00 C++14 1.00 C# 2.00 Go 2.00 Java 2.00 JavaScript 2.00 Objective-C 2.00 Perl 2.00 PHP 2.00 Python 2.00 Python3 2.00 Ruby 2.00 VB.Net 2.00

# 26/65

Solve/Submission

### Ranking

# User Language Timing
01 feodorv C 0.00s
02 twyu0721 Cpp 0.00s
03 wayne6172 C 0.00s
04 sayedalmahdi Cpp 0.01s
05 jalal Cpp 0.01s
06 RandyWaterhouse Cpp 0.01s
07 MAHRahat Cpp14 0.01s
08 AlirezaNa Cpp14 0.01s
09 killer_knight Cpp 0.01s
10 Morass Cpp14 0.02s
11 Robbinb1993 Cpp 0.02s
12 tariqiitju Cpp14 0.02s
13 SugiuraAyano C 0.03s
14 njrafi Cpp14 0.03s
15 shakilaust Cpp14 0.03s
16 sakib_muhit Cpp14 0.03s
17 CLown1331 Cpp14 0.03s
18 amit_ranjan Cpp 0.03s
19 rawson_113 Cpp 0.04s
20 seyedssz Cpp14 0.10s
21 Mahmudul_Tushar Cpp14 0.35s
Feedback