Subject:
|
Re: Reasonable assignment for a third grader?
|
Newsgroups:
|
lugnet.off-topic.geek
|
Date:
|
Thu, 12 Apr 2001 13:53:32 GMT
|
Reply-To:
|
(dan@)StopSpammers(peeron.com)
|
Viewed:
|
93 times
|
| |
| |
Larry Pieniazek <lpieniazek@mercator.com> wrote:
> I suspect the most effective way to solve this is brute force, write some
> perl or C++ or whatever to calculate the values for words from a
> dictionary... is that something a third grader should be able to do? He may
> have had this for a few days already but even if handed out on Monday, I
> think this is a lot of work to be due Thursday of the same week.
I couldn't help it... and it's my first attempt at a one liner :)
perl -ne 'BEGIN{for('a'..'z'){$v{$_}=$v{uc$_}=++$c}}$t=0;for(split//){$t+=$v{$_}};print"$_"if$t==100;' /usr/dict/linux.words
comes out with 498 words out of 45402 in the file... pretty fast too :)
--
Dan Boger
dan@peeron.com
|
|
Message has 1 Reply: | | Re: Reasonable assignment for a third grader?
|
| (...) Neither could I. This one's on sloaris, and I apologize for my mediocre coding style. It's still much more readable than that perl mess ever hoped to be, but probably took me longer. :) #include <stdio.h> int fd; FILE *fi; char buf[20]; int (...) (24 years ago, 12-Apr-01, to lugnet.off-topic.geek)
|
Message is in Reply To:
| | Reasonable assignment for a third grader?
|
| My son came home with a homework assignment today that I think is a bit tough. Here it is If you assign the letters of the alphabet numeric values with 1 == a and 26 == z, find a word starting with each letter that sums to exactly 100. Or at least (...) (24 years ago, 12-Apr-01, to lugnet.off-topic.geek)
|
20 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
This Message and its Replies on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|