10491 - Cows and Cars

All about problems in Volume 104. If there is a thread about your problem, please use it. If not, create one with its number in the subject.

Moderator: Board moderators

titid_gede
Experienced poster
Posts: 187
Joined: Wed Dec 11, 2002 2:03 pm
Location: Mount Papandayan, Garut

10491 - Cows and Cars

Post by titid_gede »

how to solve this problem? looks easy but i didnt get it.
Kalo mau kaya, buat apa sekolah?
Red Scorpion
Experienced poster
Posts: 192
Joined: Sat Nov 30, 2002 5:14 am

Post by Red Scorpion »

Yes, this is an easy problem, try to think about possibilities. :lol: :lol: :lol:
mido
Learning poster
Posts: 78
Joined: Sun Jun 16, 2002 9:48 pm
Location: Cairo,Egypt

Post 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....
titid_gede
Experienced poster
Posts: 187
Joined: Wed Dec 11, 2002 2:03 pm
Location: Mount Papandayan, Garut

Post 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? :-?
Kalo mau kaya, buat apa sekolah?
titid_gede
Experienced poster
Posts: 187
Joined: Wed Dec 11, 2002 2:03 pm
Location: Mount Papandayan, Garut

Post by titid_gede »

forget it, now i got AC. i read problem carefully, and find what i missed.
Kalo mau kaya, buat apa sekolah?
Shr33
New poster
Posts: 3
Joined: Mon May 26, 2008 4:51 pm

Re: 10491 - Cows and Cars

Post 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
898989
Learning poster
Posts: 83
Joined: Wed Feb 01, 2006 12:59 pm
Location: (Fci-cu) Egypt
Contact:

Re: 10491 - Cows and Cars

Post by 898989 »

I still can not figure out how to solve it. Can any one gives more explanation.
Sleep enough after death, it is the time to work.
Mostafa Saad
stcheung
Experienced poster
Posts: 114
Joined: Mon Nov 18, 2002 6:48 am
Contact:

Re: 10491 - Cows and Cars

Post 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.
codeworrior
New poster
Posts: 14
Joined: Wed Oct 21, 2009 11:04 am

Re: 10491 - Cows and Cars

Post by codeworrior »

whats the problem in my code..its giving me WA ...is tht scanf line is correct????
Last edited by codeworrior on Wed Oct 28, 2009 12:00 pm, edited 1 time in total.
Taman
New poster
Posts: 32
Joined: Sun Oct 11, 2009 8:59 pm
Location: Southeast University

Re: 10491 - Cows and Cars

Post by Taman »

@codeworrior:
try double data type instead of float. . .and it should work. . .
codeworrior
New poster
Posts: 14
Joined: Wed Oct 21, 2009 11:04 am

Re: 10491 - Cows and Cars

Post by codeworrior »

thnx buddy...done now..bt wats d problem with float ..i think i was within range and precision was also ok...
Taman
New poster
Posts: 32
Joined: Sun Oct 11, 2009 8:59 pm
Location: Southeast University

Re: 10491 - Cows and Cars

Post 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."
Taman
New poster
Posts: 32
Joined: Sun Oct 11, 2009 8:59 pm
Location: Southeast University

Re: 10491 - Cows and Cars

Post by Taman »

@Codeworrior: As u are done by now, plz remove your code as early as possilbe. . .thnx
mak(cse_DU)
Learning poster
Posts: 72
Joined: Tue May 30, 2006 5:57 pm
Location: bangladesh

Re: 10491 - Cows and Cars

Post by mak(cse_DU) »

!!!!!!!!!!!!!!!!!!
With adding eps=1e-8 gave me WA.
With discarding this eps I got AC.
Surprise.
Mak
Help me PLZ!!
Shafaet_du
Experienced poster
Posts: 147
Joined: Mon Jun 07, 2010 11:43 am
Location: University Of Dhaka,Bangladesh
Contact:

Re: 10491 - Cows and Cars

Post 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!
Post Reply

Return to “Volume 104 (10400-10499)”