博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
模拟退火 Buried memory
阅读量:5275 次
发布时间:2019-06-14

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

Each person had do something foolish along with his or her growth.But,when he or she did this that time,they could not predict that this thing is a mistake and they will want this thing would rather not happened.
The world king Sconbin is not the exception.One day,Sconbin was sleeping,then swakened by one nightmare.It turned out that his love letters to Dufein were made public in his dream.These foolish letters might ruin his throne.Sconbin decided to destroy the letters by the military exercises's opportunity.The missile is the best weapon.Considered the execution of the missile,Sconbin chose to use one missile with the minimum destruction.
Sconbin had writen N letters to Dufein, she buried these letters on different places.Sconbin got the places by difficult,he wants to know where is the best place launch the missile,and the smallest radius of the burst area. Let's help Sconbin to get the award.

InputThere are many test cases.Each case consists of a positive integer N(N<500,^V^,our great king might be a considerate lover) on a line followed by N lines giving the coordinates of N letters.Each coordinates have two numbers,x coordinate and y coordinate.N=0 is the end of the input file.OutputFor each case,there should be a single line in the output,containing three numbers,the first and second are x and y coordinates of the missile to launch,the third is the smallest radius the missile need to destroy all N letters.All output numbers are rounded to the second digit after the decimal point.

Sample Input

31.00 1.002.00 2.003.00 3.000

Sample Output

2.00 2.00 1.41 思路:枚举圆心 找最长半径 看能否 朝着这个方向继续更新答案 code:
//#include
using namespace std;int n;#define maxnn 1000double x[maxnn],y[maxnn];double delta=0.98;double T=1;double eps=1e-9;double dist(double x1,double y1,double x2,double y2){ return sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));}void init(){ memset(x,0,sizeof(x)); memset(y,0,sizeof(y));}void tui(){ double t=100; double ans=100000000; double sx=x[1]; double sy=y[1]; double nowx=0; double nowy=0; while(t>eps) { double now=0; double nowx=sx; double nowy=sy; int pal=0; for(int i=1;i<=n;i++) { if(now
>n) { if(n==0) return 0; init(); for(int i=1;i<=n;i++) { scanf("%lf%lf",&x[i],&y[i]); } tui(); } }

 

转载于:https://www.cnblogs.com/OIEREDSION/p/11290434.html

你可能感兴趣的文章
Java大数——a^b + b^a
查看>>
简单的数据库操作
查看>>
帧的最小长度 CSMA/CD
查看>>
树状数组及其他特别简单的扩展
查看>>
普通求素数和线性筛素数
查看>>
PHP截取中英文混合字符
查看>>
电子眼抓拍大解密
查看>>
51nod1076 (边双连通)
查看>>
Linux pipe函数
查看>>
java equals 小记
查看>>
2019春 软件工程实践 助教总结
查看>>
Zerver是一个C#开发的Nginx+PHP+Mysql+memcached+redis绿色集成开发环境
查看>>
程序的静态链接,动态链接和装载 (补充)
查看>>
关于本博客说明
查看>>
[Kaggle] Sentiment Analysis on Movie Reviews
查看>>
价值观
查看>>
mongodb命令----批量更改文档字段名
查看>>
国外常见互联网盈利创新模式
查看>>
android:scaleType属性
查看>>
shell脚本
查看>>