ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1002. Phone Numbers

A closer look!
Posted by Robert Otome 21 Oct 2008 07:01
Each number maps to several letters of the alphabet. However, notice that several letters map to a single digit. If you can't go to the mountain, bring the mountain to you. Convert the words found in the dictionary for each case into digits, using the given map. Looking up which digit a letter maps to can be done in constant time if you use the right data structure. Then all that is left is to compare against the phone number given.
Re: A closer look!
Posted by shako 13 Jul 2009 13:26
Robert Otome wrote 21 October 2008 07:01
Each number maps to several letters of the alphabet. However, notice that several letters map to a single digit. If you can't go to the mountain, bring the mountain to you. Convert the words found in the dictionary for each case into digits, using the given map. Looking up which digit a letter maps to can be done in constant time if you use the right data structure. Then all that is left is to compare against the phone number given.
Re: A closer look!
Posted by Aditya Joshi 3 Mar 2013 17:12
Wow smart!
Re: A closer look!
Posted by BillSu 17 Apr 2014 13:40
Clever tips. Thanks.
Re: A closer look!
Posted by AksCode 3 Oct 2014 07:20
Great Tip.
Re: A closer look!
Posted by Forrest 12 Jul 2016 08:37
Can't believe!!!! Excellent idea!!!!
Re: A closer look!
Posted by Rumi133114 15 Oct 2019 13:22
If you can't go to the mountain, bring the mountain to you....wow what a statement!
Re: A closer look!
Posted by Ilya Lubashov 4 Nov 2019 15:27
nice, but you must check such events:
1) word contains "ij" -> "11"(simple going letter by letter algorythm), that is not right it must transform into "1"( in dict "1":"ij"), but if word contains "ii" it must transform into "11".
2) if one word ends on some digit and another starts on it.
we have words with "18" code and "89" code.
Number "189". It depends, what letters words contain. There three alternatives: take both words, take with "18" or with "89".