F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

View Compilation Error

0_0_27832541_31326.cpp: In function 'int sign(double)':
0_0_27832541_31326.cpp:16:15: error: a function-definition is not allowed here before '{' token
 int main(void){    double a,b,c,r;    srand(time(0));    while((scanf("%lf%lf%lf%lf",&a,&b,&c,&r))==4){        if(!a && !b && !c && !r)    break;        int n=3;        p[0]=Point(0,0);        p[1]=Point(a,0);        double x=(a*a+c*c-b*b)/2/a;        double y=sqrt(c*c-x*x);        p[2]=Point(x,y);//        for(int i=0;i<3;i++)    printf("%f %f\n",p[i].x,p[i].y);        double sx=0.0,sy=0.0;        double E=0.0;        double T=100;        for(int i=0;i<n;i++)    E+=CulArea(p[i],p[(i+1)%n],Circle({sx,sy},r));//        cout << E << endl;        while(T>EPS){            double mx=0.0;            double nextx,nexty;            for(int i=0;i<100;i++){                double ang=2*PI*myrand();                double nx=sx+cos(ang)*T;                double ny=sy+sin(ang)*T;                double nE=0;                for(int i=0;i<n;i++)    nE+=CulArea(p[i],p[(i+1)%n],Circle({nx,ny},r));                if(nE>mx){                    mx=nE;                    nextx=nx;                    nexty=ny;                }            }            if(sign(mx-E)>0 || exp(mx-E)/T>myrand()){                E=mx;                sx=nextx;                sy=nexty;            }            T*=0.8;        }        printf("%.2f\n",E);    }     return 0;}
               ^
0_0_27832541_31326.cpp:16:299: error: expected '}' at end of input
 int main(void){    double a,b,c,r;    srand(time(0));    while((scanf("%lf%lf%lf%lf",&a,&b,&c,&r))==4){        if(!a && !b && !c && !r)    break;        int n=3;        p[0]=Point(0,0);        p[1]=Point(a,0);        double x=(a*a+c*c-b*b)/2/a;        double y=sqrt(c*c-x*x);        p[2]=Point(x,y);//        for(int i=0;i<3;i++)    printf("%f %f\n",p[i].x,p[i].y);        double sx=0.0,sy=0.0;        double E=0.0;        double T=100;        for(int i=0;i<n;i++)    E+=CulArea(p[i],p[(i+1)%n],Circle({sx,sy},r));//        cout << E << endl;        while(T>EPS){            double mx=0.0;            double nextx,nexty;            for(int i=0;i<100;i++){                double ang=2*PI*myrand();                double nx=sx+cos(ang)*T;                double ny=sy+sin(ang)*T;                double nE=0;                for(int i=0;i<n;i++)    nE+=CulArea(p[i],p[(i+1)%n],Circle({nx,ny},r));                if(nE>mx){                    mx=nE;                    nextx=nx;                    nexty=ny;                }            }            if(sign(mx-E)>0 || exp(mx-E)/T>myrand()){                E=mx;                sx=nextx;                sy=nexty;            }            T*=0.8;        }        printf("%.2f\n",E);    }     return 0;}
                                                                                                                                                                                                                                                                                                           ^


Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-06-17 23:03:41, Gzip enabled