Problem 205

A place to air possible concerns or difficulties in understanding ProjectEuler problems. This forum is not meant to publish solutions. This forum is NOT meant to discuss solution methods or giving hints how a problem can be solved.
Forum rules
As your posts will be visible to the general public you
are requested to be thoughtful in not posting anything
that might explicitly give away how to solve a particular problem.

This forum is NOT meant to discuss solution methods for a problem.

In particular don't post any code fragments or results.

Don't start begging others to give partial answers to problems

Don't ask for hints how to solve a problem

Don't start a new topic for a problem if there already exists one


See also the topics:
Don't post any spoilers
Comments, questions and clarifications about PE problems.
subreal
Posts: 2
Joined: Thu Oct 09, 2008 1:39 pm

Problem 205

Post by subreal »

I found problem 205 to be quite easy ... but my answer is wrong and I don't have a clue, why. I checked my code many times and calculated the approximate same answer in rolling dice with the random numer generator. I seem to be missing something conceptually.

To be sure about submitting the answer: If my result were 0.123456789..., would I be correct that the answer string were "0.1234567"?

If so, could someone please confirm my toy example:
Pete has one 4-sided dice, Colin has two 2-sided dice (which might be coins).
Pete has the following possible rolls: (1), (2), (3), (4)
Colin these: (1,1), (1,2), (2,1), (2,2)
Pete does never win with (1), (2). With (3) he wins in 1 case and with (4) in 3 cases. The total number of positive outcomes is 4, the total number of outcomes is 42*22=16.
The probability for Pete to win is 0.25=4/16, for Colin it's 0.5 and for a draw it's 0.25.

So the answer would be "0.2500000".

Or do I already have a mistake in this?

User avatar
jaap
Posts: 551
Joined: Tue Mar 25, 2008 3:57 pm
Contact:

Re: Problem 205

Post by jaap »

subreal wrote:To be sure about submitting the answer: If my result were 0.123456789..., would I be correct that the answer string were "0.1234567"?
No, the correct answer would then be 0.1234568. It has to be rounded to 7 places, so upwards if the 8th place has a 5 or higher, downwards otherwise.

You example seems correct to me.

subreal
Posts: 2
Joined: Thu Oct 09, 2008 1:39 pm

Re: Problem 205

Post by subreal »

jaap wrote:
subreal wrote:To be sure about submitting the answer: If my result were 0.123456789..., would I be correct that the answer string were "0.1234567"?
No, the correct answer would then be 0.1234568. It has to be rounded to 7 places, so upwards if the 8th place has a 5 or higher, downwards otherwise.
Of course! Now my solution works! Thanks a lot!

User avatar
rayfil
Administrator
Posts: 1405
Joined: Sun Mar 26, 2006 5:30 am
Location: Quebec, Canada
Contact:

Re: Problem 205

Post by rayfil »

The only thing that was wrong in your first post was:
42*22=16 :shock:

You certainly meant 4*22=16 :)
When you assume something, you risk being wrong half the time.

hrishikesh
Posts: 3
Joined: Sat Dec 20, 2008 5:27 am
Location: India

Problem 205

Post by hrishikesh »

http://projecteuler.net/index.php?secti ... ems&id=205
Problem 205
06 September 2008


Peter has nine four-sided (pyramidal) dice, each with faces numbered 1, 2, 3, 4.
Colin has six six-sided (cubic) dice, each with faces numbered 1, 2, 3, 4, 5, 6.

Peter and Colin roll their dice and compare totals: the highest total wins. The result is a draw if the totals are equal.

What is the probability that Pyramidal Pete beats Cubic Colin? Give your answer rounded to seven decimal places in the form 0.abcdefg
I couldn't solve this problem by using combinometrics so i wrote a program to simulate the game.
After probably millions of turns (I ran the program overnight), I got this answer

Code: Select all

0.#######
(number removed by ed_r)

But the website doesn't accept this answer. I am concerned whether my approach is right since the random numbers generated in my program are pseudorandom and not truly random..
Do you think my aprroach is right?
Also how off I am from the correct answer?
Last edited by harryh on Sun Jan 04, 2009 1:07 pm, edited 2 times in total.
Reason: deleted potential spoiler

User avatar
ed_r
Posts: 1009
Joined: Sun Jul 29, 2007 10:57 am

Re: Problem #205

Post by ed_r »

Looks like your simulator is pretty good — your answer was fairly close to the right one …

Now you just need to find a way of solving the problem analytically.
!647 = &8FDF4C

Zoron
Posts: 1
Joined: Tue Jan 20, 2009 10:11 pm

Re: Problem 205

Post by Zoron »

I am in a similar situation to the other two posters: I have a solution and found the problem easy, but the form will not accept my solution. I have analytically solved the problem two different ways, and ran a brute-force simulator in C to confirm. The simulator gave an answer that differed in the last relevant decimal place, so I spammed the solution form with a reasonable range of 7th digits, to no avail. Is it OK if I post code here, since it doesn't work? :? What about posting the answer that I'm getting?

The analytic approaches I used were based on http://en.wikipedia.org/wiki/Dice#Probability .

Zoron

User avatar
daniel.is.fischer
Posts: 2400
Joined: Sun Sep 02, 2007 11:15 pm
Location: Bremen, Germany

Re: Problem 205

Post by daniel.is.fischer »

Please don't post code or answer, you can PM me and I'll look into it.
Il faut respecter la montagne -- c'est pourquoi les gypaètes sont là.

mario62
Posts: 6
Joined: Tue Feb 24, 2009 8:57 am

Re: Problem 205

Post by mario62 »

subreal wrote:I found problem 205 to be quite easy ... but my answer is wrong and I don't have a clue, why. I checked
Pete does never win with (1), (2). With (3) he wins in 1 case and with (4) in 3 cases. The total number of positive outcomes is 4, the total number of outcomes is 42*22=16.
The probability for Pete to win is 0.25=4/16, for Colin it's 0.5 and for a draw it's 0.25.

So the answer would be "0.2500000".
Is 0.25 really the correct answer which is asked for? This ignores the case "equal". Its imo just the probability that Pete wins, after 1 draw of the dices and ignoring that the game continues when we have an equal draw.

User avatar
daniel.is.fischer
Posts: 2400
Joined: Sun Sep 02, 2007 11:15 pm
Location: Bremen, Germany

Re: Problem 205

Post by daniel.is.fischer »

A draw is a valid outcome, so the game doesn't continue if the sums are equal. Thus, apart from the already mentioned typo 42*22 = 16, subreal's example is correct.
Il faut respecter la montagne -- c'est pourquoi les gypaètes sont là.

spiketheimpaler
Posts: 3
Joined: Wed May 13, 2009 8:56 pm

Re: Problem 205

Post by spiketheimpaler »

I have worked out a solution that gives the correct answer to the example in this thread, as well as provides the correct probabilities of each roll for each player, but it keeps saying that my answer is wrong. Can someone at least confirm that the number of possible outcomes is
Expand
(4^4)*(6^6)=11943936
?

If someone could look at my (python) code that might help.

quilan
Posts: 182
Joined: Fri Aug 03, 2007 11:08 pm

Re: Problem 205

Post by quilan »

spiketheimpaler wrote:I have worked out a solution that gives the correct answer to the example in this thread, as well as provides the correct probabilities of each roll for each player, but it keeps saying that my answer is wrong. Can someone at least confirm that the number of possible outcomes is
Expand
(4^4)*(6^6)=11943936
?

If someone could look at my (python) code that might help.
I don't believe I'm spoiling too much, but the total possibilities are
Expand
nine four-sided * six six-sided = 49*66 = 12230590464
... unless I'm being dumb.
ex ~100%'er... until the gf came along.
Image

spiketheimpaler
Posts: 3
Joined: Wed May 13, 2009 8:56 pm

Re: Problem 205

Post by spiketheimpaler »

Wow. I am incredibly stupid sometimes.

That would explain alot. It's correct now.

...Seriously, I hate when I do that. Like sometimes I swear 3^3 is 9.

elr
Posts: 67
Joined: Thu Apr 09, 2009 9:47 am

Re: Problem 205

Post by elr »

can someone explain me please what does
"compare totals" mean ?

does it mean that for example peter throw his dices
for dice #1 he got : 3
for dice #2 he got : 1
for dice #3 he got : 4
for dice #4 he got : 3
for dice #5 he got : 3
for dice #6 he got : 1
for dice #7 he got : 2
for dice #8 he got : 3
for dice #9 he got : 3

so peter total would be 3+1+4+3+3+1+2+3+3 = 23

and colin throw his dices and
for dice #1 he got : 3
for dice #2 he got : 5
for dice #3 he got : 4
for dice #4 he got : 3
for dice #5 he got : 6
for dice #6 he got : 1

so colin total would be 3+5+4+3+6+1 = 22

and for this case we can say that peter won ?
Image

zwuupeape
Posts: 189
Joined: Tue Jun 09, 2009 6:11 pm

Re: Problem 205

Post by zwuupeape »

Yeah, that's what it means

elr
Posts: 67
Joined: Thu Apr 09, 2009 9:47 am

Re: Problem 205

Post by elr »

yeay i've solved it :)

i think its would have been good if there was an example
at the problem page which explain the "compare totals" issue

anyway thats a neat problem :)
Image

sacherjj
Posts: 1
Joined: Tue May 25, 2010 8:56 pm

Re: Problem 205

Post by sacherjj »

I wasn't sure what else to do on this problem. I implemented a solution in Python, that seemed correct. It was pretty fast (not measurable by time()). The answer ws rejected.

After working through my code, I couldn't find an error, so I finally searched for a solution. Those out there are returning the same exact answer I am getting.

I assumed the form 0.abcdef mean type in abcdef. For anyone hitting the same problem, type in 0.abcdef. Duh.

denshade
Posts: 2
Joined: Wed Mar 16, 2011 9:00 pm

Re: Problem 205

Post by denshade »

Holy cow,
I just copied over the last digits blindly:
0.abcdefg

and missed that you had to round them too. I just missed quite some time and hair on that one :?

User avatar
udiboy
Posts: 3
Joined: Wed Jan 22, 2014 7:26 am
Location: Mumbai, India

Re: Problem 205

Post by udiboy »

Can someone help me out here:

If Pete throws 1,2,3,4,1,2,3,4,1 on his nine dice, and if he throws 4,3,2,1,1,2,3,4,1, are these two considered the same cases or different.

According to me these should be the same cases because he is throwing the dice all at once so the order in which numbers on the dice appear shouldn't matter?

But looking at other people's posts it looks like they are to be considered as different cases, because only then will we get 4^9*6^6 different ways. This was not clear in the problem too... :? :?
Image

User avatar
TheEvil
Posts: 84
Joined: Sun Nov 13, 2011 10:38 am
Location: Szeged, Hungary

Re: Problem 205

Post by TheEvil »

The order of the nine 4-sided dice doesn't matter, but they are induvudual dice, so it should be counted as different.
An easier example:
You have two dice (normal 6-sided), and throw both of them. If the order doesn't matter the chances of throwing (two 6's) and (one 6 + one 5) should be the same, but in the real life it's not true.
Image

Post Reply