|
|
back to boardSolution Posted by MSDN 14 Oct 2007 13:54 This problem is very easy!. if N=1 output is 0; if N=2 and first language=second language output is 0; if N=2 and first language not = second language output "first"-"second" (fist and second - it's name of language) If N>2 if there are two or many equal languages output "Impossible" If N>2 if all languages different you print N and print all name languages this your language. Your language it is thought up string of latin letters. But dangerous this it. your language will be string len<10 and latin letters in small case. Tests: input: 1 a output: 0 input: 2 a a output: 0 input: 2 a b output: a-b input: 3 a b c output: a-qwerty b-qwerty c-qwerty input: 3 a a b output: Impossible Re: Solution There is one more case when N>2 and all languages are the same. Re: Solution "There is one more case when N>2 and all languages are the same". As per problem " Developers also settled if two crews are communicating then other crews must not understand a word because in that case other crew will listen instead of work and towers will not be constructed by the time". Hence the output should be "Impossible" for this case. |
|
|