Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

PI精度不够大 用acos(-1.0) AC了

Posted by narte at 2010-07-23 13:25:45 on Problem 1799
#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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator