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…
题目链接 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…
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…
好恶心的题 #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"},{"…
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…
题意 给一个三维椭球面,求球面上距离原点最近的点.输出这个距离. 题解 模拟退火. 把\(z = f(x, y)\)函数写出来,这样通过随机抖动\(x\)和\(y\)坐标就能求出\(z\). 代码 //#include <bits/stdc++.h> #include <cstdio> #include <cmath> #include <ctime> #include <algorithm> #include <iostream>…
Preface 老叶说了高中停课但是初中不停的消息后我就为争取民主献出一份力量 其实就是和老师申请了下让我们HW的三个人听课结果真停了 那么还是珍惜这次机会好好提升下自己吧不然就\(AFO\)了 List Luogu P4198 楼房重建 把高度化为斜率,然后就是个动态最长上升子序列的问题了,线段树上二分即可解决,而且可以做到\(O(n\log n)\) NOIP模拟赛10.24 实力翻车,T1主席树裸题切了,T2想了贪心+前缀和+二分正解,最后1min写完发现忘记判边界了炸到60,T3以为很难…