 Challenge: Calculate the chance of winning | Sololearn: Learn to code for FREE!

+1

# Challenge: Calculate the chance of winning

There are X boxes numbered 1 to X, each one containing one piece of paper with a unique random integer, also from 1 to X. X players play this game. Each is assigned a unique number from 1 to X and allowed to look into Y boxes. The game is won if every player has found their number. Find the best strategy and calculate the win chance based on X and Y.

0

I actually meant that you enter y and x and the program writes you the probability based on x/y, hoever everyone iz correct about the highest overall probability who wrote 0.3683 or somewhwere near

0

Also the probability is not (y/x)^x, since in that case if everyone was allowes to open 50 boxes out of 100, the prob would be much smaller than if you were to open 1 out of 2, however its less than twice as small

0

u cant comput it in here... time limit will exceed even in laptop it runs slowwww i ranged the values then come up to the probability which is 0.3683... u can read my post above...

0

yes i did... acually i want to give here the whole calculation.. but its too lengthy.. i will try some day to write that down...😀😀😁😁

0

@ ONE GUY TWO PIZZAS u got me wrong yes the probability generally will be (y/x)^x if u calculate maximum probability y will always be (x-1) for heighest chances... but y wont ever be x then its worthless to play the game... all time everyone will win.. @ biay... the ans will be as i said... i will some time give my whole method here...

0

I actually made a mistake myself. The best strat is to open the box with your number, then open the box with the number on the paper inside that box and repeat. Since you will return to start at some point, you will open the box with your number in it. Thus the chance of winning equals the probability of not having any cycles longer than y, and that depends on y/x. It also means that i will have to rethink the solution

0

i have come to the conclusion that i will have to iterate trough sum(x!/(x-k)!)/sum(x!/(x-n)!) where k are numbers from y+1 to x and n are from 1 to x

0

That still means 1/2^100 for 50 boxes out of 100 while the actual answer is somwhere near 30%

-1

hey i got the highest probability of winning is (floating point) 0.3683 the values of y and x are pretty big but after that value the probability is decreasing please reply....

-1

y cant be equal to x... yes you are right probability = (y/x)^x i was calculating for y<x cause y=x condition is awkard for this game..no point to play it then.right i ran a program on my laptop sololearn says time limit exceed so what i get was after a huge value the probability turns 0.3683.... after some values it showed 0.361... so obviously heighest probability is 0.3683..