算法之美-java有权图的表示
直接表示法
测试用例
8 16
4 5 .35
4 7 .37
5 7 .28
0 7 .16
1 5 .32
0 4 .38
2 3 .17
1 7 .19
0 2 .26
1 2 .36
1 3 .29
2 7 .34
6 2 .40
3 6 .52
6 0 .58
6 4 .93
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.Scanner;
/**
//int num = (new Double(0.999999)).intValue(); //0
//int num = (int)0.999999;//0
Double db = new Double(1);//1.0
int num = db.intValue();
System.out.println(num);//1
* @author Administrator
*18:57:03 18:58:26 18:59:06 19:19:52
*/
public class ListWeigthGraph {
static List<List<Double[]>> totallist;
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int N = scanner.nextInt();
int M = scanner.nextInt();
totallist = new ArrayList<>();
for(int i=0;i<N;i++) {
totallist.add(new LinkedList<>());
}
f