|
You
need to calculate numbers until any repetition occurs. For
preventing the time limit I use an array whose index is the
number and element is the order by which it comes. For example,
array[] is that array. Z = 5, L = 5, M = 12 and Seed is 4. Then,
Array[4]=1
Array[9]=2
Array[8]=3
Array[1]=4
Array[0]=5
and so on.
|