Page 1 of 1

Live archive, 2246 - Cracking the code

Posted: Fri Oct 29, 2004 4:16 pm
by junbin
I've created multiple solutions for this, but still WA.

The problem I think lies in the definition of "ENGLISH".

My definition is:

#define ISENGLISH(a) ( ( (a) >= '0' && (a) <= '9' ) || ( (a) >= 'a' && (a) <= 'z' ) || ( (a) >= 'A' && (a) <= 'Z' ) || (a) == ' ' || (a) == '\n' || (a) == '\r' )


ie: Any letter that is 0-9. a-z, A-Z space or newline or carriage return is english.

However, my code fails to find a key (ie: No key from length 1 to 30 which can fit the message).



Some assumptions I made (please tell me if I'm wrong):

1) There is only one test data, max length of 30k chars.
2) Key length is 1 to 29 (I use 1 to 30 to be safe)
3) Key can only be a-z and 0-9 (total of 36 characters, no upper case)


If anyone has solved it and can help, please do. Thanks! :)

Posted: Fri Oct 29, 2004 5:09 pm
by Adrian Kuegel
As far as I know, on the regional contest each team got a sample of an english text. You can download it somewhere. Anyway, you will notice soon that it contains a lot of "the". This helps a lot to find the right key.