You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

19 lines
1.1 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

package class_2022_03_5_week;
// 来自网易
// 我军一起干掉敌人的最少移动数
// km算法的又一个题
// 给定一个矩阵int[][] matrix
// matrix[i][j] == -2代表此处(i,j)有山脉,无法通行
// matrix[i][j] == -1代表此处(i,j)是一个敌军
// matrix[i][j] == 0代表此处(i,j)是空地,可以自由行动
// matrix[i][j] > 0代表此处(i,j)是一个我军行动能力就是matrix[i][j]
// 我军只能上、下、左、右移动只可以穿过同样是我军的地点和空地的地点但是最多移动matrix[i][j]步
// 任何一个我军都不能穿过山脉,任何一个我军可以来到敌军的位置,表示消灭了敌军,但是如果这么做了,这个我军就不能再移动了
// 你可以任意决定所有我军的行动策略,每一步你都可以随意选择一个友军移动随意方向的,但是必须合法。
// 如果你可以让所有我军在消耗完自身的行动能力之前,消灭所有的敌军,请返回总距离的最小值
// 如果你就是无法消灭所有敌军,返回-1
public class Code04_KillAllSameTime {
}