Problem 067
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.
See also the topics:
Don't post any spoilers
Comments, questions and clarifications about PE problems.
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
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.
- jaap
- Posts: 588
- Joined: Tue Mar 25, 2008 3:57 pm
- Contact:
Re: Problem 067
Please remove that number from your post because that is actually the correct answer. It should be accepted if you type it in correctly.
-
matts1
- Posts: 5
- Joined: Sat May 07, 2011 11:19 pm
-
alvoha
- Posts: 2
- Joined: Thu Jun 23, 2011 6:11 pm
Re: Problem 067
I have a problem. I read the input from a text file, but i get a wrong solution when i read from the 'triangle.txt' file. I, however, get the right solution when i copy the content of triangle.txt over in a new file, and read from that one instead. I can see that triangle.txt is 100 Bytes bigger than my new file.
Can anyone tell me what those 100 bytes are? As I'm sure that's what caused all my headache
. Thanks!
Can anyone tell me what those 100 bytes are? As I'm sure that's what caused all my headache
- jaap
- Posts: 588
- Joined: Tue Mar 25, 2008 3:57 pm
- Contact:
Re: Problem 067
Are you working on a non-Windows machine maybe? If so, it could the the line endings. Windows uses 2-byte line endings (ascii 10 and 13), whereas Linux and most other operating systems use only 1-byte endings (ascii 10 only). A file with those extra endline characters may cause your program to fail.alvoha wrote:I have a problem. I read the input from a text file, but i get a wrong solution when i read from the 'triangle.txt' file. I, however, get the right solution when i copy the content of triangle.txt over in a new file, and read from that one instead. I can see that triangle.txt is 100 Bytes bigger than my new file.
Can anyone tell me what those 100 bytes are? As I'm sure that's what caused all my headache. Thanks!
- rayfil
- Administrator
- Posts: 1412
- Joined: Sun Mar 26, 2006 5:30 am
- Location: Quebec, Canada
- Contact:
Re: Problem 067
Effectively, the lines endings in the subject file is the single-byte ascii 10. Some programs can handle such files (regardless if under Windows or other) as you have experienced with the one you used to read the file before saving it back. However, your programming environment seems to require a two-byte ending in order to process the file correctly.
In the future, you may want to check the type of line ending of any text file you need before trying to process it. There are many free hex editors on the internet.
In the future, you may want to check the type of line ending of any text file you need before trying to process it. There are many free hex editors on the internet.
When you assume something, you risk being wrong half the time.
-
alvoha
- Posts: 2
- Joined: Thu Jun 23, 2011 6:11 pm
Re: Problem 067
Thanks! I'm using Linux and Vim so it was definitely the 2 byte newlines in triangle.txt that caused trouble. Thanks for the hex-editor tip.
-
Sahexa
- Posts: 1
- Joined: Sun Aug 07, 2016 6:25 pm
Re: Problem 067
Hello,
I'm trying to submit this problem couple of hours, but every time i'm seeing "Incorrect answer".I think my algorithm is right.
I tested it with Problem 18 and 1-2 another triangles and it returned every time right answer except Problem 67.
Is there a problem with Problem 67?
I'm trying to submit this problem couple of hours, but every time i'm seeing "Incorrect answer".I think my algorithm is right.
I tested it with Problem 18 and 1-2 another triangles and it returned every time right answer except Problem 67.
Is there a problem with Problem 67?
Last edited by Sahexa on Mon Aug 08, 2016 12:16 am, edited 2 times in total.
- hk
- Administrator
- Posts: 12832
- Joined: Sun Mar 26, 2006 10:34 am
- Location: Haren, Netherlands
Re: Problem 067
No, there isn't.

War ruins the life and health of untold numbers of innocent children.

