111 -> 1 + 1 + 1 -> 3 -> 3*3 -> 10 (9 in base 9) -> 1 + 0 -> 1 happy!

On Sep 12, 7:28 pm, Squall <[email protected]> wrote:
> Input
> 3
> 2 3
> 2 3 7
> 9 10
>
> Output
> Case #1: 3
> Case #2: 143
> Case #3: 91
>
> For case #3,  decimal value 91 in base 9 is 111.
> 111->1+1+1->3
> How does 3 qualified as "happy number" ?

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"google-codejam" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/google-code?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to