题目链接:http://acm.hust.edu.cn/vjudge/contest/123674#problem/G 这题和上一道题差不多,还更简单点,直接用prim算法就行,直接贴AC代码: import java.io.BufferedInputStream; import java.util.Scanner; public class Main { final static int N = 1 << 20; static int n, m, a[][] = new int[105][1…
题目链接:http://acm.hust.edu.cn/vjudge/contest/126708#problem/G 这是一个01背包的模板题 AC代码: #include<stdio.h> #include<string.h> #include<algorithm> using namespace std; ]; struct Node { int xishouliang; int xingfuzhi; } a[]; int main() { int i, j, t…