编程介的小学生
2017-11-06 01:43Mouse
10Problem 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条回答
为你推荐
- Java语言高分悬赏:怎么获得鼠标在Jpanel中的坐标,并且在坐标处画圆
- 开发语言
- 2个回答
- python中现在是对实时图像选择目标,怎么修改代码能实现对已有视频按下空格可以选择目标,然后继续识别目标
- 深度学习
- 人工智能
- python
- list
- 1个回答
- PHP / CSS onmouseover和onmouse out不适用于PHP echo
- css
- html
- php
- 3个回答
- python里怎么样监控鼠标按下的是左键还是右键
- python
- 2个回答
- Mouse
- lines
- each
- 1个回答