iDB Community Forum

Full Version: Lenny Conundrum #183
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
It is me... or there is more than 1 possible solution? I found more than 8

Quote:A wise old Kougra has a puzzle for you:

"Suppose each letter is worth a certain number of points: A = 1 point, B = 2, C = 3, and so on. Then, make all vowels negative."

"Now, I'm thinking of three different pets. Each has a number of points based on the letters in the name of their species, and they are all different species. If the total number of points for all three is 203, what are the three pets?"

At this point, you ask the Kougra, "What about the letter Y? Isn't it sometimes considered a vowel?"

The Kougra looks at you. "Y DOES NOT WORK THAT WAY!" he bellows. "Err, sorry for that outburst. Just assume that it isn't a vowel. Oh! And I forgot to mention that the first letter in the species name should have double points."

What are the three pets the Kougra is thinking of? Please submit your answer by putting all three pet names in alphabetical order, with no spaces or punctuation between the names. For example, if the answer was Ixi, Lupe, and Chia, you would submit the answer "chiaixilupe"`
I found more than one as well Smile
i just stopped afer the 1st Smile
I found 138. Toungue

Although a few of them have doubles. I was too lazy to code an exception for those.
Did you all remember to double the value of the first letter and make sure all vowels were negative? My little group of friends came up with one answer.
Yes we did that, anyway for the example chiaixilupe, you double the c, i and l right ?
Of course! That part of the problem was painfully clear and the easiest part to code thanks to my little friend 0x20.

So either I'm right or I misread the problem statement. The code tested all 157464 permutations of pet species, and as I'm really lazy it tested such useful strings as AcaraAcaraAcara.

Also, I didn't bother checking for permuted solutions. If AcaraAishaFlotsam was valid, so was AcaraFlotsamAisha and both would be printed. Neither are, mind you, so the actual number of unique solutions is much lower than my post implies.
But the answer supposed to be in alphabetical order, so acaraaishaflotsam is != acaraflotsamaisha Toungue
so only 54x53x52 searches requrired instad of 54^3

but of course we're not required to find the number of searches Toungue
Right, but making the code smarter to do that requires more effort than 54^3. If n was larger, it'd be worth the time to reduce it to n!/(n-3)!, but it's a one shot piece of code.

So point wise those are equal, and I can alphabetize in constant time. Not worth the effort. Toungue
lol I'm not sure hows your code is but roughly I think like this
pets : {acara, ..., zafara}
for i=0;i<pets.number bla bla
for j=0;j<pets.number bla bla
for k=0;k<pets.number bla bla
do the calculation

but mine is roughly like this
for i=0;i<pets.number bla bla
for j=i+1;j<pets.number bla bla
for k=j+1;k<pets.number bla bla

so that's not really "much effort"

well if I'm wrong, its always a pleasure to learn something new Smile
My code was half recursive due to a fit of boredom, so it wouldn't have been as simple to modify.

But you are right. Toungue
Pages: 1 2
Reference URL's