JAVA算法题,求最优路线,请大神指点!

图片说明
图片说明
public class Config {

static final int STATION_COUNT = 10;//车站数

static final float TIME_OF_ONE_RIDE = 3.0f;//行走一个站的时间(分钟)

static final float TIME_OF_ONE_STOP = 0.5f;//停靠一次站的时间(分钟)

static final String[] STATION_NAMES = new String[]{"A","B","C","D","E","F","G","H","I","J"};//站名

static final int INIT_INDEX = 7;//车子的起始站点号

static int[][] countsOfFromTo = null;//从某站到目的站的候车人数

/*
 * 下面通过静态构造器来对二维数组进行初始化
 */
static {
    //countsOfFromTo[i][j]表示从i站到j站的候车人数
    countsOfFromTo = new int[][]{
        /**************A,B,C,D,E,F,G,H,I,J*/
        /*A*/new int[]{0,5,3,7,8,2,6,4,2,3},
        /*B*/new int[]{1,0,4,3,7,6,3,4,2,6},
        /*C*/new int[]{3,2,0,7,5,4,7,5,1,2},
        /*D*/new int[]{5,1,2,0,5,3,3,1,8,6},
        /*E*/new int[]{4,2,7,3,0,6,1,5,4,3},
        /*F*/new int[]{2,9,6,2,1,0,3,6,5,1},
        /*G*/new int[]{6,1,4,3,5,2,0,3,2,4},
        /*H*/new int[]{3,2,5,1,8,2,3,0,7,4},
        /*I*/new int[]{4,2,6,3,1,7,5,2,0,3},
        /*J*/new int[]{7,1,4,8,1,2,9,1,5,0}
    };
}

}

1个回答

图片说明

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!