I have recently joined topcoder and have been practicing in practice room for the past few days. I have come to know about this problem which I think is unable to solve. Any help will be appreciated.
Problem
The product value of the string is the product of all points ('0' - '9') string. For example, the product value of "123" is 1 * 2 * 3 = 6. A string is said to be colored, if it contains only digits and each of its non-comparatively intensive substrings has different product values. For example, the string "263" has six substrings: "2", "6", "3", "26", "63" and "263". The product values of these substring are: respectively 2, 6, 3, 2 * 6 = 12, 6 * 3 = 18 and 2 * 6 * 3 = 36. Because all six product values are different, "263" is colorful
On the other hand, "236" is not color because its two substrings, "6" and "23" have the same product values (6 = 2 * 3).
Return the smallest color string in the form of a Kashmir-A (1-based) dictionary If less than the color strings of the length, then return an empty string instead.
My perspective
We can not do 'N' and '1' in the form of digits should be different. Therefore, to start, n should be smaller than 9. (Only digits 2, 3, 4, 5, 6, 7, 8, 9 can be used, each one of them once).
We know that, we can start with the "23" (the smallest 2-digit color string) as a base string and add a single digit (string still on each pair Colorful or not) N
My question
>
I think this approach Will not be fast enough. Even if it is, then in what order should I play with the number, so that I can start from the smallest and make my way through the smallest?
How can I progress with this problem? Or are there smart ways to follow these kinds of problems?
I am not asking any solution or nothing I am asking for some clues and some lead.
Some problems that I resolve in seconds, it takes a few hours to think something, and in some ways I can not do this like this. But I believe there is some practice in it, but I can not progress without anyone.
Thanks in advance =)
* By the way, this question is from SRM 464 DIV 2 - 500 PT Trouble. All copyright leads to TopCoder.
There is a forum in the topcoder with each SRM (464). Perhaps your question has already been answered there :)
Comments
Post a Comment