Live archive, 2246 - Cracking the code

Do you want to discuss about these problems? Go now!
Users are shared (no need to re-register).

Moderator: Board moderators

Post Reply
junbin
Experienced poster
Posts: 174
Joined: Mon Dec 08, 2003 10:41 am

Live archive, 2246 - Cracking the code

Post by junbin » Fri Oct 29, 2004 4:16 pm

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! :)

Adrian Kuegel
Guru
Posts: 724
Joined: Wed Dec 19, 2001 2:00 am
Location: Germany

Post by Adrian Kuegel » Fri Oct 29, 2004 5:09 pm

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.

Post Reply

Return to “ACM ICPC Archive Board”