博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
poj1556The Doors
阅读量:4574 次
发布时间:2019-06-08

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

枚举两点 若不和任何线段相交 建边为dis(i,j) floyd求最短路

1 #include 
2 #include
3 #include
4 #include
5 #include
6 #include
7 #include
8 #include
9 #include
10 using namespace std; 11 #define N 100 12 #define LL long long 13 #define INF 0xfffffff 14 const double eps = 1e-8; 15 const double pi = acos(-1.0); 16 const double inf = ~0u>>2; 17 struct point 18 { 19 double x,y; 20 point(double x=0,double y=0):x(x),y(y){} 21 }p[N]; 22 struct line 23 { 24 point u,v; 25 }li[N]; 26 double w[N][N]; 27 typedef point pointt; 28 pointt operator - (point a,point b) 29 { 30 return pointt(a.x-b.x,a.y-b.y); 31 } 32 int dcmp(double x) 33 { 34 if(fabs(x)
o) 96 w[i][j] = w[j][i] = dis(p[i]-p[j]); 97 //printf("%.2f %.2f %.2f %.2f %.2f\n",p[i].x,p[i].y,p[j].x,p[j].y,w[i][j]); 98 } 99 for(i = 1; i <= g+2 ; i++)100 for(j = 1; j <=g+2 ;j++)101 for(k = 1; k <= g+2 ; k++)102 w[j][k] = min(w[j][i]+w[i][k],w[j][k]);103 printf("%.2f\n",w[g+1][g+2]);104 }105 return 0;106 }
View Code

 

转载于:https://www.cnblogs.com/shangyu/p/3883641.html

你可能感兴趣的文章
AngularJS(九):路由
查看>>
Google chrome浏览器HTML5 Beta项目, 未来Web前瞻!
查看>>
GPS.NET 和 GeoFramework开源了
查看>>
汇编:采用址表的方法编写程序实现C程序的switch功能
查看>>
AtiveMQ初次连接的 http error:503 连接错误 Prolem accessing /.Reason : Service Unavailable...
查看>>
Lua1.1 Lua 的参考手册 (三)
查看>>
OFO和摩拜共享单车
查看>>
Linux软件安装管理之1——rpm命令管理
查看>>
visual studio 2017 使用笔记
查看>>
iTerm2 半透明颜色主题与字体配置
查看>>
《Entity Framework 6 Recipes》中文翻译系列 (14) -----第三章 查询之查询中设置默认值和存储过程返回多结果集...
查看>>
asp.net后台InputStream存储图片,前台js接收解析存放路径地址
查看>>
双飞翼布局和圣杯布局
查看>>
java并发编程之CountDownLatch与CyclicBarrier
查看>>
AOJ 0525 - Osenbei
查看>>
iOS 直播-闪光灯的使用
查看>>
关于 Failed to establish a new connection: [Errno 11004] getaddrinfo failed',))的问题
查看>>
python数据类型之间的转换
查看>>
[T-ARA][I'm so bad]
查看>>
win7,win10获取屏幕缩放适应截图
查看>>