A challenge from the Mensa Puzzle Calendar

Kevin P. Rice b140a67 at hotmail.com
Sat Nov 2 01:04:24 EST 2002


Piet van Oostrum <piet at cs.uu.nl> wrote in message news:<wz7kg06q5r.fsf at cs.uu.nl>...
> >>>>> b140a67 at hotmail.com (Kevin P. Rice) (KPR) writes:
> 
> KPR> Anything that takes 4 seconds on a GHz machine sounds slow to me...
> KPR> so, just for comparison (fun) I wrote a solution in C++ (see below).
> KPR> On my 1.6 GHz laptop this code runs in 0.007 seconds -- over 500 times
> KPR> faster! The code is a bit ugly for efficiency reasons. Also, I store
> KPR> the results in an array because I found that printing to the screen
> KPR> took nearly four times as long as the program itself! A cleaner,
> KPR> easier to comprehend version ran in about 0.02 seconds.
> 
> if it took you more than 3.993 seconds more to write the C++ version than
> the Python version then your C++ version is too slow :=)

Yes, that's nice to know. But with that logic the Python version is
much too slow also since there's already a working program that does
the same thing (see below), and, it's faster than 4 seconds, too...
Did I mention this was for fun? Thanks for the jab-- I think the point
was that (1) speed is relative, (2) Python is nice, but it's not
universal, and, (3) how many BILLION instructions does it take to boot
Windows, anyway? There's only 128 MB or so of memory to fill up--that
should only take 0.1 seconds, right??!!?

Cryptarithm solver:

DEAN v.2.00 (C source)
http://www.und.edu/org/crypto/crypto/cryptarithm/dean/

DEAN v.1.00 (compiled .exe for MS-DOS):
ftp://ftp.simtel.net/pub/simtelnet/msdos/educate/dean100.zip

For the Mensa puzzle create a text file with the following:
abc*de=fghij;a=7

Then run DEAN 'file' to get the puzzle solution!



More information about the Python-list mailing list