题目:
三分,求包括所有给出点的最小圆锥的高和半径.说实话这道题还不怎么理解.
自己一直WA,主要是搜索时cal与三分的条件没写对.参考别人的代码A了.还得回来看.
#include#include using namespace std;struct point{ double x; double y;}p[10005];int n;double cal(double h){ double R=0; for(int i=0;i 1e-8) { mid = (left+right)/2; midmid = (mid + right)/2; R1 = cal(mid); R2 = cal(midmid); if(mid*R1*R1>midmid*R2*R2) { left= mid; }else { right = midmid; } } return mid; }int main(int argc, const char *argv[]){ int T; scanf("%d",&T); while(T--) { scanf("%d",&n); double h = 0 , r = 0 ,Y; for(int i=0;i