诡异的一个包乱入,导致题目从100分到0分。。。我擦
package didi;
import java.io.BufferedInputStream;
import java.util.Scanner;
<span style="color:#ff0000;">import sword.stack2que;</span>
public class T1 {
public static int[][] dir = {{1,0,0},{0,1,1},{-1,0,3},{0,-1,1}};
public static int n = 0;
public static int m = 0;
public static int p = 0;
public static int[][] min = new int[2][300];
public static int[][] curr = new int[2][300];
public static int mintime = Integer.MAX_VALUE;
public static int currtime = 0;
public static int steps = 0;
public static int beststeps = 0;
public static void main(String[] args) {
Scanner scanner = new Scanner(new BufferedInputStream(System.in));
n = scanner.nextInt();
m = scanner.nextInt();
p = scanner.nextInt();
int[][] maze = new int[n][m];
for(int i = 0 ; i < n ; i++){
for(int j = 0 ; j < m ;j++){
maze[i][j] = scanner.nextInt();
}
}
maze[0][0]=0;
go(0, 0, maze);
// System.out.println(cango(1, 0, 0, 1, maze));
if(mintime==Integer.MAX_VALUE)System.out.println("Can not escape!");
else {System.out.print("["+min[0][0]+","+min[1][0]+"]");
for(int i = 1 ; i< beststeps ; i++){
System.out.print(",["+min[0][i]+","+min[1][i]+"]");
}
System.out.print(",["+0+","+(m-1)+"]");
}
}
public static void go(int a,int b,int[][] maze){
if(a==0&&b==m-1){
if(p>=currtime){
if(currtime<mintime){
mintime = currtime;
min=curr.clone();
beststeps = steps;
}
}
}
for(int i = 0 ; i < 4 ; i++){
// System.out.println(cango(a, b, dir[i][0], dir[i][1], maze)+" "+p);
if(cango(a, b, dir[i][0], dir[i][1], maze)){
steps++;
curr[0][steps]=a+dir[i][0];
curr[1][steps]=b+dir[i][1];
currtime+=dir[i][2];
// System.out.println(curr[0][steps]+" "+curr[1][steps]+" "+currtime);
maze[a+dir[i][0]][b+dir[i][1]]=0;
go(a+dir[i][0], b+dir[i][1], maze);
maze[a+dir[i][0]][b+dir[i][1]]=1;
currtime-=dir[i][2];
steps--;
}
}
}
public static boolean cango(int i,int j,int a,int b,int[][] maze){
if(i+a>=0&&i+a<n&&j+b>=0&&j+b<m&&maze[i+a][j+b]==1&&p>=currtime)return true;
return false;
}
}
//4 4 10
//1 0 0 1
//1 1 0 1
//0 1 1 1
//0 0 1 1