Now the only problem of the post is that the sign ' doesn’t render well.
So it is the first time, maybe the last time…
Here I want to try a new form to deliver my post.
You see, I won’t use Chinese in the post. Instead, I’d like to write this blog in English.
The only reason is that I’m very bored…
At first, we can see that if we want to piece together a $10$, the only factor we need are $2$ and $5$.
Apart from these two factors, we can not find any other factors has the ability to piece together $10$.
Since we have the basis thinking, let’s find what is the truly roundness.
If we divide the number $a _ i$ till there is no roundness in it, we can get another number $a ^ {\prime} _ i$.
The number $a ^ {\prime} _ i$ will have a beatiful nature: It doesn’t have factor $2$ and factor $5$ at the same time.
So we might as well define the status $f ( i , j , k )$, which indicates that $j$ numbers have been selected in the previous $i$ numbers, and the products has already had $k$ factors $2$.
Similarly, we define $g ( i , j , k )$, the only difference between them is that the $k$ of $g$ represents the number of $5$.
Now, we can try to write the transform of the state:
$$ f ( i , j , k ) \rightarrow \begin{cases} f ( i + 1 , j , k ) \\ f ( i + 1 , j + 1 , k + c _ 2 ( i + 1 )) \\ f ( i + 1 , j + 1 , k - c _ 5 ( i + 1 )) \\ g ( i + 1 , j + 1 c _ 5 ( i + 1 ) - k ) \end{cases} $$
The state $g$ is similar:
$$ g( i , j , k ) \rightarrow \begin{cases} g ( i + 1 , j , k ) \\ g ( i + 1 , j + 1 , k + c _ 5 ( i + 1 )) \\ g ( i + 1 , j + 1 , k - c _ 2 ( i + 1 )) \\ f ( i + 1 , j + 1 , c _ 2 ( i + 1 ) - k ) \end{cases} $$
And the time complexity of it is $ O( n ^ 3 \log a) $.
Because the online judge isn’t very stable, it takes me some time to accept the problem…