Text problems...
-
Thomas Lehmann
- Posts: 6
- Joined: Thu Nov 22, 2007 6:51 pm
Text problems...
Hi,
I assume I don't see the point also I have been of the opinion
that everything is clear: problem 93!
First of all - of course - I would try to solve the problem for
the given solution and - well - this has been no problem!
The final algorithm: The solution gets rejected:
Now - in my words - how I understood the problem and - may be -
someone could be so kind to correct this:
- collect all values for any digit combination (a, b, c, d) but each digit
can be used once!
- storing the calculated values under the key (a, b, c, d) that way
so that a < b < c < d.
- Finally I have to search for that key with a list of calculated values
to count (beginning by 1) until a hole occurs, example:
key a,b,c,d with the values = [1, 2, 4, 5, 6] --> count = 2, because 3 is missing!
Required Output (final solution): that key with biggest count!
What's wrong with it?
I assume I don't see the point also I have been of the opinion
that everything is clear: problem 93!
First of all - of course - I would try to solve the problem for
the given solution and - well - this has been no problem!
The final algorithm: The solution gets rejected:
Now - in my words - how I understood the problem and - may be -
someone could be so kind to correct this:
- collect all values for any digit combination (a, b, c, d) but each digit
can be used once!
- storing the calculated values under the key (a, b, c, d) that way
so that a < b < c < d.
- Finally I have to search for that key with a list of calculated values
to count (beginning by 1) until a hole occurs, example:
key a,b,c,d with the values = [1, 2, 4, 5, 6] --> count = 2, because 3 is missing!
Required Output (final solution): that key with biggest count!
What's wrong with it?
- daniel.is.fischer
- Posts: 2400
- Joined: Sun Sep 02, 2007 11:15 pm
- Location: Bremen, Germany
Re: Text problems...
Nothing, that's correct. You didn't separate the digits by commata or spaces, did you?
Il faut respecter la montagne -- c'est pourquoi les gypaètes sont là.
-
Thomas Lehmann
- Posts: 6
- Joined: Thu Nov 22, 2007 6:51 pm
Re: Text problems...
No!
Here some data:
a) my rejected answer: 5689 (with 57 consecutive positive integers).
b) there are 11 ways of placing brackets.
c) for each b) there are 64 combinations of placing operators
between the digits.
Something wrong at b) or c) ?
kindly
Thomas
Here some data:
a) my rejected answer: 5689 (with 57 consecutive positive integers).
b) there are 11 ways of placing brackets.
c) for each b) there are 64 combinations of placing operators
between the digits.
Something wrong at b) or c) ?
kindly
Thomas
- daniel.is.fischer
- Posts: 2400
- Joined: Sun Sep 02, 2007 11:15 pm
- Location: Bremen, Germany
Re: Text problems...
I find fewer distinct ways of placing parentheses. c) seems correct to me.
How do you create 39 with 5,6,8,9?
How do you create 39 with 5,6,8,9?
Il faut respecter la montagne -- c'est pourquoi les gypaètes sont là.
-
Thomas Lehmann
- Posts: 6
- Joined: Thu Nov 22, 2007 6:51 pm
Re: Text problems...
- It took a little to prepare some more debug outputs...
- I'm storing results under the key 5689 (a < b < c < d) for
any combinations of 5, 6, 8 and 9.
- 39 is not available for 5,6,8,9 but for (5 + 8) * (9 - 6) -> 5,8,9,6
- OK If you want to say I have to store each combination
separated I have done this as a try:
My result now: 4721 with 33 conseq. values from 1 to n but
Neither 4721 nor 1247 (a < b < c < d) has been accepted.
- I'm storing results under the key 5689 (a < b < c < d) for
any combinations of 5, 6, 8 and 9.
- 39 is not available for 5,6,8,9 but for (5 + 8) * (9 - 6) -> 5,8,9,6
- OK If you want to say I have to store each combination
separated I have done this as a try:
My result now: 4721 with 33 conseq. values from 1 to n but
Neither 4721 nor 1247 (a < b < c < d) has been accepted.
- daniel.is.fischer
- Posts: 2400
- Joined: Sun Sep 02, 2007 11:15 pm
- Location: Bremen, Germany
Re: Text problems...
Drat, should've deleted my incorrect code. Found the correct, you shouldn't be able to create 40 with 5,6,8,9.
Il faut respecter la montagne -- c'est pourquoi les gypaètes sont là.
-
Thomas Lehmann
- Posts: 6
- Joined: Thu Nov 22, 2007 6:51 pm
Re: Text problems...
- Ok, storing each a,b,c,d combination
seperately I can not form 40 for 5689!
- When I'm trying to limit my four loops
to the condition a < b < c < d I get
3568 with 17 conseq. integer values (1..n)
and also rejected!
- Next I'm trying to do is to use float values,
because:
(5 + 6 / 9 ) * 8 = 40
(5.0 + 6.0 / 9.0) * 8.0 = 45.000000
May be I'm wrong to do so ....
seperately I can not form 40 for 5689!
- When I'm trying to limit my four loops
to the condition a < b < c < d I get
3568 with 17 conseq. integer values (1..n)
and also rejected!
- Next I'm trying to do is to use float values,
because:
(5 + 6 / 9 ) * 8 = 40
(5.0 + 6.0 / 9.0) * 8.0 = 45.000000
May be I'm wrong to do so ....
- daniel.is.fischer
- Posts: 2400
- Joined: Sun Sep 02, 2007 11:15 pm
- Location: Bremen, Germany
Re: Text problems...
Seems we found your problem, 1/2 = 0.5, ordinary arithmetics, not computer integer arithmetic.
Il faut respecter la montagne -- c'est pourquoi les gypaètes sont là.
-
Thomas Lehmann
- Posts: 6
- Joined: Thu Nov 22, 2007 6:51 pm
Re: Text problems...
Solved.
However - in opposite to many other euler problems
the author of this problem has avoided to say too
much (my opinion)!
It's a kind of "reading between the lines".
thanks for your kind help!
Thomas
However - in opposite to many other euler problems
the author of this problem has avoided to say too
much (my opinion)!
It's a kind of "reading between the lines".
thanks for your kind help!
Thomas
- rayfil
- Administrator
- Posts: 1412
- Joined: Sun Mar 26, 2006 5:30 am
- Location: Quebec, Canada
- Contact:
Re: Text problems...
I can easily see how you can go wrong using integer maths on a computer. You can also go wrong using floats but I can't figure out how you could ever get that result. Would you be kind enough to enlighten us on how your algo could produce that.(5.0 + 6.0 / 9.0) * 8.0 = 45.000000
When you assume something, you risk being wrong half the time.
-
JohnMorris
- Posts: 64
- Joined: Sun Dec 23, 2007 6:38 am
Re: Text problems...
Just idle speculation:rayfil wrote:I can easily see how you can go wrong using integer maths on a computer. You can also go wrong using floats but I can't figure out how you could ever get that result. Would you be kind enough to enlighten us on how your algo could produce that.(5.0 + 6.0 / 9.0) * 8.0 = 45.000000
Code: Select all
int i = (5.0 + 6.0 / 9.0) * 8.0;
printf ("%.6f\n", (float)i);

-
Thomas Lehmann
- Posts: 6
- Joined: Thu Nov 22, 2007 6:51 pm
Re: Text problems...
Ahhh, the problem I have had was to recognize to
calculate in float arthmetic and - in addition - that not getting
an integer like result means to ignore the result. That's why I
have had some confusing output and the one you were talking
about simlpy results from an integer printed as a float value.
Now everything is fine! Thanks for help!
calculate in float arthmetic and - in addition - that not getting
an integer like result means to ignore the result. That's why I
have had some confusing output and the one you were talking
about simlpy results from an integer printed as a float value.
Now everything is fine! Thanks for help!