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 » Fri May 16, 2003 5:25 pm

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 » Sat May 17, 2003 3:57 am

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 » Tue May 20, 2003 12:47 pm

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 » Tue May 20, 2003 3:14 pm

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 » Thu May 22, 2003 7:42 am

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 » Mon May 26, 2008 4:58 pm

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 » Fri Oct 17, 2008 12:42 am

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 » Mon Jan 19, 2009 9:59 am

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 » Wed Oct 21, 2009 11:09 am

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 » Sun Oct 25, 2009 10:14 pm

@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 » Tue Oct 27, 2009 5:42 pm

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 » Tue Oct 27, 2009 8:51 pm

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 » Tue Oct 27, 2009 8:53 pm

@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) » Sun Apr 18, 2010 4:49 pm

!!!!!!!!!!!!!!!!!!
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 » Wed Oct 13, 2010 4:21 pm

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)”