| ||||||||||
| 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 | |||||||||
PI精度不够大 用acos(-1.0) AC了#include <iostream>
#include <cmath>
#include<iomanip>
using namespace std;
const double PI=acos(-1.0);
double compute_r(double R,double n)
{
double temp;
temp=R*sin(PI/n)/(sin(PI/n)+1);
return temp;
};
int main()
{
double R,n,r;
int q,p=1;
cin>>q;
while(p<=q)
{
cin>>R>>n;
if(R>=1&&R<=100&n>=2&&n<=100)
{ cout<<"Scenario #"<<p<<":"<<endl;
cout<<setiosflags(ios::fixed)<<setprecision(3);
cout<<compute_r(R,n)<<endl;
cout<<endl;}
p++;
}
return 0;
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator