poj 2253
来源:互联网 发布:淘宝网价格 编辑:程序博客网 时间:2024/06/07 19:10
原题
思路:求所有路径中最大跳跃距离的最小值, 很诡异的是输出答案如果用G++,.3lf%格式会出错,c++可以过
#include<cstdio>#include<cmath>#include<vector>#include<iostream>#include<stack>#include<cstring>using namespace std;const double INF=0x3f3f3f3f;const int maxn=2e2+10;double mp[maxn][maxn], dis[maxn][maxn], cor[maxn][maxn];int n;int main(){ int cas=0; while(~scanf("%d", &n) && n) { for(int i=1; i<=n; i++) { scanf("%lf%lf", &cor[i][0], &cor[i][1]); //cout<<cor[i][0]<<" "<<cor[i][1]<<endl; } for(int i=1; i<=n; i++) { for(int j=1; j<=n; j++) { double x2, y2; x2=(cor[i][0]-cor[j][0])*(cor[i][0]-cor[j][0]); y2=(cor[i][1]-cor[j][1])*(cor[i][1]-cor[j][1]); dis[i][j]=mp[i][j]=sqrt(x2 + y2); //cout<<mp[i][j]<<" "; } //cout<<endl; } for(int k=1; k<=n; k++) for(int i=1; i<=n; i++) for(int j=1; j<=n; j++) dis[i][j]=min(dis[i][j], max(dis[i][k], dis[k][j])); printf("Scenario #%d\n", ++cas); printf("Frog Distance = %.3lf\n\n", dis[1][2]); } return 0;}
阅读全文
0 0
- poj-2253
- poj 2253
- poj 2253
- POJ 2253
- poj 2253
- poj 2253
- poj.2253
- poj 2253
- poj-2253
- poj 2253
- POJ 2253
- POJ 2253
- POJ 2253
- POJ 2253
- POJ 2253
- poj 2253
- poj----2253
- poj ---2253
- LiquiBase概述及(spring boot 入门配置)
- Shiro是@RequestMapping失效,调用404异常
- 【ZooKeeper】Java客户端API使用介绍。
- Spring下载地址
- python学习笔记
- poj 2253
- pandas中apply的使用方法
- HDOJ2178 猜数字
- layer类与scene类的区别?
- 最长公共子序列
- oracle数据库rownum讲解,
- 多项式轨迹--三次多项式轨迹
- 堆排序
- OOD架构设计模式中MVC与ECB