编程介的小学生 2019-01-27 19:02 采纳率: 20.5%
浏览 534

一个随机漫步的问题,使用C语言的算法实现,请教下怎么实现才能解决

Problem Description
Yuanfang is walking on a chain. The chain has n nodes numbered from 1 to n. Every second, he can move from node i to node j with probability:

c(i,j) is an element in a given parameter matrix which is n×m. (1 <= c(i, j) <= 9)
Yuanfang wants to know the expectation time for him to walk from node 1 to node n.

Input
There are no more than 10 test cases.
In each case, there are two integers n (2 <= n <= 50000), m (1 <= m <= 5), in the first line, meaning that there are n nodes and the parameter matrix is n×m . There are m integers in each of the next n lines which describe the parameter matrix .
The input ends with 0 0.

Output
For each case, output the expectation time for Yuanfang to walk from node 1 to node n in one line. The answer should be rounded to 2 digits after decimal point.

Sample Input
3 1
1
1
1
5 2
1 2
2 1
3 2
2 3
1 3
0 0

Sample Output
6.94
8.75

  • 写回答

2条回答 默认 最新

  • weixin_39240662 2019-01-28 10:14
    关注

    你试试 哈哈哈哈哈哈哈哈哈哈哈哈哈皮一下
    if (comboBox1.Text == "xxx" && comboBox2.Text == "yyy")
    ...

    第二个办法可以用and连接
    string filter = "xxx like yyy and zzz like aaa"

    评论

报告相同问题?

悬赏问题

  • ¥15 求差集那个函数有问题,有无佬可以解决
  • ¥15 【提问】基于Invest的水源涵养
  • ¥20 微信网友居然可以通过vx号找到我绑的手机号
  • ¥15 寻一个支付宝扫码远程授权登录的软件助手app
  • ¥15 解riccati方程组
  • ¥15 display:none;样式在嵌套结构中的已设置了display样式的元素上不起作用?
  • ¥15 使用rabbitMQ 消息队列作为url源进行多线程爬取时,总有几个url没有处理的问题。
  • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决
  • ¥50 树莓派安卓APK系统签名
  • ¥65 汇编语言除法溢出问题