摘要:
#include<stdio.h>#include<math.h>#define eps 0.00000001struct node{ double x,y;}a,b,c,d;double p,q,r;void init(){ scanf("%lf%lf%lf%lf",&a.x,&a.y,&b.x,&b.y); scanf("%lf%lf%lf%lf",&c.x,&c.y,&d.x,&d.y); scanf("%lf%lf%lf",&p,& 阅读全文
摘要:
三分搜索第一题纪念三分搜索对于凹凸函数极值非常有效#include<stdio.h>#include<math.h>#define eps 0.00000001struct node{ double x,y,z;};double dist(node a,node b){ return sqrt((a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y)+(a.z-b.z)*(a.z-b.z));}int main(){ int cs,p=1;scanf("%d",&cs); while(p<=cs) { node p 阅读全文