3677 - Dominoes Probabilities 3677 - Probabilidades de Dominó 3677 - Dominoes Probabilities

Statistics Sub: 32 | AC: 25 | AC%: 78,12 | Score: 3,64
Created by Daniset González Lima
Added by morpheuz (2016-06-03)
Limits
Total Time: 10000 MS | Test Time: 1000 MS |Memory: 512 MB | Output: 64 MB | Size: 9 KB
Enabled languages
Available in

Description

Pedrito and Carlitos are always discussing about who the best is playing dominoes. Today, they decided to end with the doubts and so they are going to play a set of games to see who the best really is. They decided to play, until there is a difference of exactly N victories between them. That means, they are going to be playing until one of them has N victories more than the other one.

Your task is, knowing the probability Pc/100 of Carlitos to win a game, find the expected number of games they are going to play and the probability of Carlitos to win the bet.
Pedrito y Carlitos están discutiendo siempre acerca de quién es mejor jugando dominó. Hoy, ellos decidieron terminar con las dudas para lo realizarán un conjunto de juegos para determinar quién es realmente el mejor. Ellos decidieron que jugarían hasta que exista una diferencia de exactamente N victorias entre ellos. Esto quiere decir que ellos estarán jugando hasta que uno de ellos tanga N victorias más que el otro.

Su tarea es, conociendo la probabilidad P_c/100 de que Carlitos gane el juego, determinar cuál es el número de juegos que ellos jugarán y cuál es la probabilidad de que Carlitos gane la apuesta.
Pedrito and Carlitos are always discussing about who the best is playing dominoes. Today, they decided to end with the doubts and so they are going to play a set of games to see who the best really is. They decided to play, until there is a difference of exactly N victories between them. That means, they are going to be playing until one of them has N victories more than the other one.

Your task is, knowing the probability Pc/100 of Carlitos to win a game, find the expected number of games they are going to play and the probability of Carlitos to win the bet.

Input specification

The input will consist of a single line containing two integers:  1 <= N <= 100 and 0 <= Pc <= 100.
La entrada está formada por una línea simple con dos enteros: 1 <= N <= 100 y 0 <= P_c <= 100.
The input will consist of a single line containing two integers:  1 <= N <= 100 and 0 <= Pc <= 100.

Output specification

The output will consist of a single line containing two numbers separated by a space. The first number is the expected number of games they are going to play and the second the probability of Carlitos to win the bet. To be accepted, your answer must be rounded to exactly five decimal places.
La salida consistirá de una línea formada por dos números separados por un espacio simple, indicando la cantidad esperada de juegos que ellos van a jugar y la probabilidad de que Carlitos gane la apuesta. Imprima su solución redondeada con 5 lugares decimales.
The input will consist of a single line containing two integers:  1 <= N <= 100 and 0 <= Pc <= 100.

Sample input

1 50

Sample output

1.00000 0.50000

Hint(s)

Sample Input 2
4 65

Sample Output 2
11.26542 0.92245
Sample Input 2
4 65

Sample Output 2
11.26542 0.92245
Sample Input 2
4 65

Sample Output 2
11.26542 0.92245

Recommendation

We have carefully selected several similar problems: 2156 | 2243 | 3479 | 1811 | 2141 | 1650