描述:
There is a square matrix n × n, consisting of non-negative integer numbers. You should find such a way on it that
- starts in the upper left cell of the matrix;
- each following cell is to the right or down from the current cell;
- the way ends in the bottom right cell.
Moreover, if we multiply together all the numbers along the way, the result should be the least "round". In other words, it should end in the least possible number of zeros.
输入:
The first line contains an integer number n (2 ≤ n ≤ 1000), n is the size of the matrix. Then follow n lines containing the matrix elements (non-negative integer numbers not exceeding 109).
输出:
In the first line print the least number of trailing zeros. In the second line print the correspondent way itself.
样例输入:
3 1 2 3 4 5 6 7 8 9
样例输出:
0 DDRR
描述:
有一个 n x n 的正方形矩阵,由非负整数组成。你应该找到如下的一种路:
从矩阵的左上单元格开始
后面的每个单元格都在当前单元格的右侧或下方
这条路在右下角的单元格结束
而且,如果我们把所有的数字相乘,结果应该是最小的整数。换句话说,它应该以尽可能少的0结尾。
输入:
第一行包括一个整数n(2 ≤ n ≤ 1000),n是矩阵的大小。然后接下来的n行包括矩阵的元素(不超过109的非负整数)。
输出:
第一行输出最小数的尾随零,第二行输出它本身的通信方法。
样例输入:
3 1 2 3 4 5 6 7 8 9
样例输出:
0 DDRR
题目地址链接:Problem - B - Codeforces