|
|
back to boardWA #7 here's my code. I've tried many testes but i've passed them\ #include <iostream> #include <iomanip> #include <cmath> using namespace std;
double f(double r, double a) { double rad=(a*4*atan((double)1))/180; double da=sqrt( 2*r*r-2*r*r*cos(rad) ); return da; }
int main() { double r,a,re,da,nr,rad; cin>>r>>a; re=r; nr=floor((double)180/a); da=f(r,2*a); re+=((nr-1)*da); double mod=360-floor(360/(2*a))*(2*a); //cout<<mod<<'\n'; if(mod) re+=f(r,mod); cout<<fixed<<setprecision(6)<<re; return 0; } |
|
|