Problem 042

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.
Post Reply
Traverse
Posts: 3
Joined: Wed Mar 23, 2011 2:05 am

Problem 042

Post by Traverse »

Hello, all.

Is it possible something has changed with the text file for problem Problem 42 (View Problem)? To clarify, 42 involves finding the number of so-called "triangle words" in a text file of common English words. I'm relatively confident in my algorithm (problem is pretty straight-forward), but I keep coming up with the same number, which comes back wrong. Also, the text file is reported to have nearly 2000 words, whereas the file I downloaded only had 1786. "Nearly 2000" seems a little generous, so I'm wondering if something has changed with the file. Believe me, I've tested a lot of other possibilities before questioning the text file.

Maybe I'm just screwed w/r to this one?
TripleM
Posts: 384
Joined: Fri Sep 12, 2008 3:31 am

Re: Problem 42

Post by TripleM »

1786 is correct, as is the text file and the accepted answer :)
Traverse
Posts: 3
Joined: Wed Mar 23, 2011 2:05 am

Re: Problem 042

Post by Traverse »

Dang.
Traverse
Posts: 3
Joined: Wed Mar 23, 2011 2:05 am

Re: Problem 042

Post by Traverse »

Just figured it out. Cheers!
cdd
Posts: 9
Joined: Sun Mar 27, 2011 6:51 am

Re: Problem 042

Post by cdd »

i keep getting 77 which is incorrect. Can someone let me know if this is close, so i can see if my algorithm is working at all.
User avatar
rayfil
Administrator
Posts: 1412
Joined: Sun Mar 26, 2006 5:30 am
Location: Quebec, Canada
Contact:

Re: Problem 042

Post by rayfil »

@cdd
I would suggest that you scrap your existing algo and restart totally from scratch in a few days after you have forgotten how you tried to solve it in the first place.

Take a good look at the given example and make sure you understand it. Look at the word.txt file with Notepad or any other text editor and understand its structure so that you can parse it correctly with your algo.
When you assume something, you risk being wrong half the time.
cdd
Posts: 9
Joined: Sun Mar 27, 2011 6:51 am

Re: Problem 042

Post by cdd »

thanks for the reply. Im pretty sure my algorithm is correct but could PM you my code for you to take a look at just to make sure?
cdd
Posts: 9
Joined: Sun Mar 27, 2011 6:51 am

Re: Problem 042

Post by cdd »

nvm figured it out, i forgot that vectors start at the 0th index not 1. :oops:
tomalmy
Posts: 3
Joined: Wed Oct 19, 2011 5:48 pm

Re: Problem 042

Post by tomalmy »

Anybody doing this had ought to do problem 22 first. They are closely related.
Post Reply