Page 1 of 2

10491 - Cows and Cars

Posted: Fri May 16, 2003 5:25 pm
by titid_gede
how to solve this problem? looks easy but i didnt get it.

Posted: Sat May 17, 2003 3:57 am
by Red Scorpion
Yes, this is an easy problem, try to think about possibilities. :lol: :lol: :lol:

Posted: Tue May 20, 2003 12:47 pm
by mido
Quite easy, but can get very annoying. To solve it, I thought about the probabilities of the paths one might take in each case. This helped me get to the solutions presented in the sample output. Continue thinking from there....

Posted: Tue May 20, 2003 3:14 pm
by titid_gede
Yes, look easy but very annoying me. e.g for input 2 1 1. there are 3 doors, which two of them contains cows. so first the probability of getting cars is 1/3. then a door which contained cow opened. here i saw that probability of getting car if i change the choice is 0.5. since i know there is only one car and one cow, it's fifty fifty. or my analysis is wrong? :-?

Posted: Thu May 22, 2003 7:42 am
by titid_gede
forget it, now i got AC. i read problem carefully, and find what i missed.

Re: 10491 - Cows and Cars

Posted: Mon May 26, 2008 4:58 pm
by Shr33
i do a mistake S0 PLS ,
i wanna specify that all shows are done at a single time
NOTTTT one by oneeee okkkk

S0 THIS IS EASY QUESTION DONT THINK DIFFERENT TAKE IT EASY

Re: 10491 - Cows and Cars

Posted: Fri Oct 17, 2008 12:42 am
by 898989
I still can not figure out how to solve it. Can any one gives more explanation.

Re: 10491 - Cows and Cars

Posted: Mon Jan 19, 2009 9:59 am
by stcheung
Consider these 2 scenarios:
(1) Cow was initially chosen, then a Car was chosen after doors are revealed
(2) Car was initially chosen, then a Car was chosen after doors are revealed

The result is the sum of their probabilities.

Re: 10491 - Cows and Cars

Posted: Wed Oct 21, 2009 11:09 am
by codeworrior
whats the problem in my code..its giving me WA ...is tht scanf line is correct????

Re: 10491 - Cows and Cars

Posted: Sun Oct 25, 2009 10:14 pm
by Taman
@codeworrior:
try double data type instead of float. . .and it should work. . .

Re: 10491 - Cows and Cars

Posted: Tue Oct 27, 2009 5:42 pm
by codeworrior
thnx buddy...done now..bt wats d problem with float ..i think i was within range and precision was also ok...

Re: 10491 - Cows and Cars

Posted: Tue Oct 27, 2009 8:51 pm
by Taman
Ok, simply I can quote Shahriar Manzoor, "It is always a good idea to use double instead of float because double gives higher precision and range.Sometimes it is specified in the problem statement to use float type. In those cases, use floats."

Re: 10491 - Cows and Cars

Posted: Tue Oct 27, 2009 8:53 pm
by Taman
@Codeworrior: As u are done by now, plz remove your code as early as possilbe. . .thnx

Re: 10491 - Cows and Cars

Posted: Sun Apr 18, 2010 4:49 pm
by mak(cse_DU)
!!!!!!!!!!!!!!!!!!
With adding eps=1e-8 gave me WA.
With discarding this eps I got AC.
Surprise.

Re: 10491 - Cows and Cars

Posted: Wed Oct 13, 2010 4:21 pm
by Shafaet_du
You dont need eps.
input:

Code: Select all

100 100 12
10 10 9
5 5 2
1 1 0
34 64 24
output:

Code: Select all

0.53209
0.95000
0.64286
0.50000
0.86777
best of luck!