怎么改这个程序才能实现求a,d,h的最优解
#include<math.h>#include <stdio.h>
#define pi 3.1415926
void main()
{int a,h,l,i,sum;
double d,k,m,b,s,y,z,f,c,e,x,x1,x2,x3,x4,g,n;
sum=0;
l=1550;
k=1090.204;
m=502.8;
for(a=50;d<91;a++)
{for(d=70;a<111;d++)
{for(h=-20;h<201;h++)
{for(i=1;i<28;i++)
{f=(d*pi)/180;
x=(i*pi)/180;
x1=cos(f);
x2=sin(f);
x3=cos(f-x);
x4=sin(f-x);
g=(k-m)/2;
b=sqrt((g-a*x1)*(g-a*x1)-(a*x2-h)*(a*x2-h));
s=a*x3+sqrt(b*b-(a*x4-h)*(a*x4-h))-g;
n=g-s;
c=sqrt(h*h+n*n);
y=(atan(h/n)+acos((a*a+h*h+n*n-b*b)/(2*a*c)))*180/pi;
z=atan(1/((1/tan(x))-(k/l)))*180/pi;
e=y-z;
if(e<0.5&&e>-0.5)
{sum=sum+i;
printf("sum=%d\n",sum);}
else
sum=0;;}
if(sum==351)
{
printf("h=%d\n",h);
printf("d=%d\n",d);
printf("a=%d\n",a);
sum=0;}
else
sum=0;}
}}
printf("s=%lf\n",s);
printf("y=%lf\n",y);
printf("z=%lf\n",z);
printf("b=%lf\n",b);
}