The least round way

描述:

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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值