#K59357. Colorful Number
Colorful Number
Colorful Number
Given a positive integer \(n\), determine if it is a colorful number. A number is defined as colorful if the product of every contiguous subsequence of its digits is unique. For example, consider \(3245\):
Its contiguous subsequences and their corresponding products are:
- 3, 2, 4, 5
- 3 \(\times\) 2 = 6, 2 \(\times\) 4 = 8, 4 \(\times\) 5 = 20
- 3 \(\times\) 2 \(\times\) 4 = 24, 2 \(\times\) 4 \(\times\) 5 = 40
- 3 \(\times\) 2 \(\times\) 4 \(\times\) 5 = 120
Since all these products are distinct, \(3245\) is colorful. Otherwise, if any product repeats, the number is not colorful.
inputFormat
The input consists of a single positive integer \(n\) provided via standard input. You can assume \(n\) is within a reasonable range (e.g., \(1 \le n < 10^{10}\)).
outputFormat
Print True
if the number is colorful, otherwise print False
. The output should be printed to standard output.
3245
True