Click here to Skip to main content
15,887,434 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
I entered the South African Computer Olympiad for high school students. I found it relatively easy. It was not much of a challenge, with the exception of one particular question. The question proposes an alien language, which uses only one character to write with, '%'. The full problem can be seen at: http://www.olympiad.org.za/docs/R2Qs_BW_2010.pdf (Question 5: Messages)

This question baffled me. I have absolutely no idea whatsoever how to solve this puzzle.

BTW, this had to be done in either Java or Python.

Thanks,

Genius
Posted

What the question is looking for can be re-expressed like this:
How many different ways can we divide a pile of beans? By different, we mean that the sizes of the resulting piles are not all the same. For example,
1 => 1
2 => 2, 1 1
3 => 3, 2 1, 1 1 1
4 => 4, 3 1, 2 2, 2 1 1, 1 1 1 1
5 => 5, 4 1, 3 2, 3 1 1, 2 1 1 1, 1 1 1 1 1
so (translating back into Unarus-language) there are
1 message of 1 letter
2 messages of 2 letters
3 messages of 3 letters
5 messages of 4 letters
6 messages of 5 letters
... and so on.

Suggestions about where to go from here:
1. Think about the following problem:
If we have the solution for n beans, how do we find the solution for n+1?
2. Think about this one:
Why does the fourth letter add two solutions when the others around it only add one? Before you write them out, how many would you expect for six letters?

My gut feel is that attacking suggestion #2 will lead to a better answer than #1.
Good luck, and ENJOY!
Peter
 
Share this answer
 
Good Question, but I shall leave it to others to solve :)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900