hdu 5017 模拟退火】的更多相关文章

hdu 5017 http://blog.csdn.net/mypsq/article/details/39340601 #include <cstdio> #include <cstring> #include <cmath> #include <algorithm> using namespace std; const int D[8][2] = {{0, 1}, {0, -1}, {1, 0}, {-1, 0}, {1, 1}, {-1, -1}, {…
http://acm.hdu.edu.cn/showproblem.php?pid=5017 求椭圆上离圆心最近的点的距离. 模拟退火和三分套三分都能解决 #include <cstdio> #include <algorithm> #include <cstring> #include <cmath> using namespace std; const double eps = 1e-8; const double r = 0.99; //降温速度 co…
题意:给出椭球面的立体解析式,要求椭球面上距离原点最近的点的距离 sol:这题要想推公式就…
为了补这题,特意学了下模拟退火算法,感觉算法本身不是很难,就是可能降温系数,步长等参数不好设置. 具体学习可以参见: http://www.cnblogs.com/heaad/archive/2010/12/20/1911614.html  我认为讲的很不错,通俗易懂. 这题设置一个step为1,降温系数为0.99,因为系数越大,得到最优解的概率越大,虽然可能会慢一点.因为是三维的,所以往八个方向扩展找邻域解,然后遇到比他优的解一定接受. 代码:(参照网上代码) #include <iostre…
题意 给一个三维椭球面,求球面上距离原点最近的点.输出这个距离. 题解 模拟退火. 把\(z = f(x, y)\)函数写出来,这样通过随机抖动\(x\)和\(y\)坐标就能求出\(z\). 代码 //#include <bits/stdc++.h> #include <cstdio> #include <cmath> #include <ctime> #include <algorithm> #include <iostream>…
Problem Description Given a 3-dimension ellipsoid(椭球面) your task is to find the minimal distance between the original point (0,0,0) and points on the ellipsoid. The distance between two points (x1,y1,z1) and (x2,y2,z2) is defined as    Input There ar…
Ellipsoid Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 850    Accepted Submission(s): 271 Special Judge Problem Description Given a 3-dimension ellipsoid(椭球面) your task is to find the minima…
HDU3932 题目大意:给定一堆点,找到一个点的位置使这个点到所有点中的最大距离最小 简单的模拟退火即可 #include <iostream> #include <cstdio> #include <cstring> #include <cstdlib> #include <cmath> #include <ctime> #include <algorithm> using namespace std; #define…
题目链接 A题:(字符串查找,水题) 题意 :输入字符串,如果字符串中包含“ Apple”, “iPhone”, “iPod”, “iPad” 就输出 “MAI MAI MAI!”,如果出现 “Sony” 就输出“SONY DAFA IS GOOD!” ,大小写敏感. 思路 : 字符串查找,水题. #include <string.h> #include <stdio.h> #include <iostream> using namespace std ; ]; int…
好恶心的题 #include <cstdio> #include <string.h> #include <algorithm> #include <cmath> #include <set> using namespace std; typedef __int64 ll; struct point{ ll word,priori; }P[]; ][]={ {"Add"},{"Close"},{"…