编程介的小学生 2019-04-28 16:53 采纳率: 20.5%
浏览 156

老鼠上楼的一个运用题的算法,在C语言的程序编写的过程的方式?

Problem Description
A greedy mouse cici ate rat poison by mistake. To save herself, she have to drink.

Cici can only walk in four ways that marked in the photoes followed and only move in the region that colored blue..She expend energy every step.There are cheese in every position which cici can eat to gain energy once she is there.He will never reach the river if she run out of energy.The initially energy of cici is energy of the cheese at the coordinate (0,0).
if when the mouse arrive a position has 0 energy , he can't eat the cheese.
Now can you help the wretched monse to calculate whether can he get to the river.
If she can,calculate the minimun energy of the maximal energy of every possible position of the river(Y = N-1).

Input
There are several test cases.In each case,there are three integers n(0<n<=200),m(0<m<=10),and k(0<k<=10)in the first line ,the next n lines followed. The second line has only one integer c(0<c<=100),the i-th line has m integers more than (i-1)th line.
k is the energy each step cost.

Output
If the monkey can not get to the river,print "what a pity mouse!!" int one line;If she can,calculate the minimun energy of the maximal energy of every possible position of the river(Y = N-1).

Sample Input
7 2 3
5
3 6 4
6 9 2 5 6
2 5 3 7 1 6 7
8 9 3 2 6 3 8 9 5
3 5 3 6 4 3 5 6 8 4 2
2 6 3 3 6 7 8 5 3 1 4 5 6

Sample Output
11

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥20 求数据集和代码#有偿答复
    • ¥15 关于下拉菜单选项关联的问题
    • ¥20 java-OJ-健康体检
    • ¥15 rs485的上拉下拉,不会对a-b<-200mv有影响吗,就是接受时,对判断逻辑0有影响吗
    • ¥15 使用phpstudy在云服务器上搭建个人网站
    • ¥15 应该如何判断含间隙的曲柄摇杆机构,轴与轴承是否发生了碰撞?
    • ¥15 vue3+express部署到nginx
    • ¥20 搭建pt1000三线制高精度测温电路
    • ¥15 使用Jdk8自带的算法,和Jdk11自带的加密结果会一样吗,不一样的话有什么解决方案,Jdk不能升级的情况
    • ¥15 画两个图 python或R