Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
Re:高手指点 哪里错了?In Reply To:高手指点 哪里错了? Posted by:harryyang at 2007-08-20 12:05:08 malloc 不对吧,里边应该有个 sizeof(float)。 > #include<stdio.h> > #include<math.h> > #include<memory.h> > #define PI 3.14159265 > void main(){ > int totalSets,i,n;float *x,*y,distanceSquare; > fscanf(stdin,"%d",&totalSets); > getc(stdin); > x=(float *)malloc(totalSets+1); > y=(float *)malloc(totalSets+1); > for(i=1;i<=totalSets;i++){ > fscanf(stdin,"%f %f",&x[i],&y[i]); > getc(stdin); > } > for(i=1;i<=totalSets;i++){ > distanceSquare=x[i]*x[i]+y[i]*y[i]; > n=ceil(PI*distanceSquare/100); > fprintf(stdout,"Property %d: This property will begin eroding in year %d.\n",i,n); > } > fprintf(stdout,"END OF OUTPUT.\n"); > } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator