Facebook Google Plus YouTube

UVA Problem 10286 (Trouble with a Pentagon) Solution

  #include <bits/stdc++.h> #include <math.h> #define pi acos(0.0) //#define pi 3.1416 int main() { double n; while(scanf(“%lf”,&n) != EOF ) { //poligon_inte_angle = (3/5)*180=(108 degree)as figure sides n=5; //square_inte_angle = (2/4)*90=(63 degree) as figure sides n=4; printf(“%.10lf\n”,( n*sin(108*pi/90 ) /…

UVA Problem 10451 (Ancient Village Sports) Solution

    #include <bits/stdc++.h> #include<iostream> #include<math.h> #define pi 2*acos(0.0) using namespace std; int main() { double n,x,y,a,R,r,A,A1,A2,spect,offic; int c=0; while(scanf(“%lf %lf”,&n,&A)==2 && n>=3) { r=sqrt((2*A)/(n*sin(2*pi/n))); //2. Given the radius (circumradius); area(A)=((r^2)nsin(360/n)/2) R=sqrt( A/(n*tan(pi/n))); //Given the apothem (inradius) area=a^2 ntan(180/n); //printf(“Case…