10432  Polygon Inside A Circle
Moderator: Board moderators

 Experienced poster
 Posts: 136
 Joined: Tue Apr 01, 2003 6:59 am
 Location: Jakarta, Indonesia

 Experienced poster
 Posts: 136
 Joined: Tue Apr 01, 2003 6:59 am
 Location: Jakarta, Indonesia
I have an another question.
Suppose the number of sides is 2000, then the circle will be divided in 2000 parts which will make the angle of every part 360/2000 degree.
So to calculate the sin is:
Am I correct?
Suppose the number of sides is 2000, then the circle will be divided in 2000 parts which will make the angle of every part 360/2000 degree.
So to calculate the sin is:
Code: Select all
pi=3.141593;
angle=sin(2*pi/n);

 Experienced poster
 Posts: 136
 Joined: Tue Apr 01, 2003 6:59 am
 Location: Jakarta, Indonesia

 Experienced poster
 Posts: 136
 Joined: Tue Apr 01, 2003 6:59 am
 Location: Jakarta, Indonesia
1 (arc) second = 1/60 (arc) minute = 1/60 degree
Last edited by UFP2161 on Wed Aug 20, 2003 4:21 pm, edited 2 times in total.
should it be:
1 deg = 60 min = 3600 sec ?
1 deg = 60 min = 3600 sec ?
7th Contest of Newbies
Date: December 31st, 2011 (Saturday)
Time: 12:00  16:00 (UTC)
URL: http://uva.onlinejudge.org
Date: December 31st, 2011 (Saturday)
Time: 12:00  16:00 (UTC)
URL: http://uva.onlinejudge.org

 Experienced poster
 Posts: 136
 Joined: Tue Apr 01, 2003 6:59 am
 Location: Jakarta, Indonesia
I've tried both
Thanx anyway for the help guys!!!
and1 (arc) second = 1/60 (arc) minute = 1/60 degree
and find the second is the correct one.1 deg = 60 min = 3600 sec
Thanx anyway for the help guys!!!
There are 3 things one need to be successful : motivation, ability and chance. And if you're a believer, make it four : God's will.
10432
Hi,
I'm getting a WA for this problem.
First I tried a straightforward approach:
 divide the polygone into triangles,
 compute height and base of a triangle
 compute the area of a triangle
 multiply by no. of triangles to get the area of the polygone.
> WA
After that I tried the equations I've found here.
> WA
Subsequently I created a file containing 5000 random values in the
range 1 .. 20000 and ran all four versions.
Identical results but WA.
Hints and/or test data would be very welcome!
Thanks
I'm getting a WA for this problem.
First I tried a straightforward approach:
 divide the polygone into triangles,
 compute height and base of a triangle
 compute the area of a triangle
 multiply by no. of triangles to get the area of the polygone.
> WA
After that I tried the equations I've found here.
> WA
Subsequently I created a file containing 5000 random values in the
range 1 .. 20000 and ran all four versions.
Identical results but WA.
Code: Select all
int main(void)
{
int r, n;
double area, dn, dr;
double al, h, x, x2, b;
double PI;
while (scanf("%lf %d",&dr,&n) == 2){
dn = (double) n;
/* dr = (double) r;*/
printf("\n");
/* 1st version: WA
compute height and base for a triangle,
find area and multiply by n
PI = 3.1415926535897932384626;
al = 180.0/dn;
x = 2.0*dr*sin(al*PI/180.0);
x2 = x*0.5;
h = sqrt(dr*drx2*x2);
area = dn*(x*h*0.5);
printf("%.3lf\n",area);*/
/* 2nd version: WA
simplified equation from a post
PI = 3.1415926535897932384626433832795029L;
al = 180.0  ((double)180.0*(dn2.0)/dn);
area = (sin(PI/180.0*al)*dr*dr*dn)/2.0;
printf("%.3lf\n",area); */
/* 3rd version: WA
same as eq. 2 with some constants replaced
PI = 2.0*acos(0.0);
b = acos(1.0);
al = b  (b*(dn2.0)/dn);
area = (sin(PI/b*al)*dr*dr*dn)*0.5;
printf("%.3lf\n",area); */
/* 4th version: WA
same as 3 with new eq. for sin(alpha) */
al = sin(acos(1.0)*2.0/n);
area = (al*dr*dr*dn)*0.5;
printf("%.3lf\n",area);
}
return 0;
}
Thanks

 Guru
 Posts: 834
 Joined: Wed May 29, 2002 4:11 pm
 Location: Wroclaw, Poland
 Contact:

 New poster
 Posts: 11
 Joined: Sun Jul 18, 2004 1:39 am
10432  Polygon Inside A Circle Why WA?
Hi,
Can someont tell me what is wrong with my code.
Outputs seems ok
Thanks in advance!!!!!!
Can someont tell me what is wrong with my code.
Outputs seems ok
Code: Select all
Code removed after accepted
Last edited by p!ter on Wed Jan 26, 2005 6:25 pm, edited 1 time in total.