Thursday, August 12, 2010

UVa 613 Numbers That Count

Problem: count the number of each decimal digits of given number, and then concatenate the counts and the digits to get a new number called "inventory'. Iterately get the inventory of the inventory, and find self-inventorying numbers or inventory loops. Size: each number have 80 digits at most, and 15 iterations to see at most.

It is easy since we don't need to find the loop after 15 iterations. Just do string manupulations and comparisons. Using char array speeds up.

No comments: