博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
HDU1875 畅通工程再续
阅读量:4358 次
发布时间:2019-06-07

本文共 863 字,大约阅读时间需要 2 分钟。

代码如下:

#include 
#include
#include
const double INF = (1<<25);#define MAXN 103#define MAXM 10010struct Pos{ int x, y;}pos[MAXN];int vis[MAXN];double G[MAXN][MAXN], d[MAXN], ans;double calc(struct Pos a, struct Pos b){ int k = (a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y); if(k<100 || k>1000000) return INF; else return sqrt(k*1.0);}int prim(int n){ int i, x, y, flag; double m; for(i=0; i
d[y]) {m = d[x=y]; flag = 1;} if(!flag) break; vis[x] = 1; ans += m; for(y=0; y
G[x][y]) d[y] = G[x][y]; } return flag;}int main(){ int n, i, j, T; scanf("%d", &T); while(T--){ scanf("%d", &n); ans = 0.0; for(i=0; i

 

 

转载于:https://www.cnblogs.com/tanhehe/archive/2013/03/01/2939337.html

你可能感兴趣的文章
CSRF
查看>>
【计算机网络】OSI模型,TCPIP模型
查看>>
Token 认证的来龙去脉
查看>>
Oracle——视图
查看>>
No input file specified
查看>>
获取字符串中出现次数最多的字符
查看>>
Selenium3自动化问题一:selenium3在火狐浏览器执行driver.quit()报错2052解决方案
查看>>
hdoj1754 线段树--单点更新
查看>>
算法题之一(数字二进制形式中1的个数)
查看>>
python学习--去除空格
查看>>
3D渲染管线的概述
查看>>
数据挖掘看问题不能太局部,还要更全面一些
查看>>
HDU 3395 Special Fish
查看>>
Arduino 数字函数总结
查看>>
开店选址需经过的五道坎
查看>>
P1020 导弹拦截
查看>>
C# 对文本文件的几种读写方法总结
查看>>
git仓库使用
查看>>
数据结构-循环顺序队列&链队列
查看>>
xlistview(头xml)
查看>>