Uva1151 RTE 找了半天不知道哪里有问题....

#include<iostream>
#include<algorithm>
#include<cstdlib>
#include<cstdio>
#include<cstring>
#include<vector>
#include<string>
#include<limits.h>
#include<cmath>
#include<map>
using namespace std;

struct edge
{
    int u,v,w;
    edge(int a,int b,int c):u(a),v(b),w(c) {};
    edge(){};
};

int tc;
int q,n;        //方案数 q<=8  节点数 n<=1000
const int famax=8;
const int nodemax=1010;
int p[nodemax];         //每个点属于的连通集
int facost[famax];      //每个方案的代价 <=2*10^6  可以用Int存
vector<int> fanode[famax];     //每个方案覆盖的点的序号
vector<int> xpos;       //每个点的坐标  [0,3000]
vector<int> ypos;
//vector<int> graph[nodemax];     //【这个似乎不需要,可以删掉】
vector<edge> edges;      //【如果边的性质不止权重怎么办来着??】
            //Kruskal应该基本上都这样存吧...必须要把边聚在一起,不然怎么好排序
vector<int>useful;     //我们最后要用的边
double costmax=INT_MAX;         // 【是不是这么写的啊啊啊啊 !!!】

bool cmp(int a, int b)
{
    return edges[a].w < edges[b].w;
}

void init();
void solve();
int find(int a);
void clearp();

int main()
{
//freopen(“1151in.txt”,”r”,stdin);
cin>>tc;
while(tc–)
{
init();
solve();
}
return 0;
}

void solve()
{
//先进行排序 并找出最小的N-1条边
//计算各边
int ec=0; //edge count 从0开始计数
for(int i=0;i

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值