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

神 啊,救救我吧!这个程序的结果和答案一样啊 ,怎么就是WRONG ANSWER 啊!

Posted by yangjie at 2005-04-23 12:42:45 on Problem 1005
#include <iostream.h>
#include <math.h>
const double PI=3.1415;
class point
{
	double X,Y;
public:
	point(double xx,double yy){X=xx;Y=yy;}
	double GetX(){return X;}
	double GetY(){return Y;}
};
double radius(int n)
{
	
	if(n==0)
	return 0.0;
	else
		return sqrt(100/PI+radius(n-1)*radius(n-1));
}
void main()
{
	int N;
	cin>>N;
	double *M;
		M=new double [N];
	for(int  i=1;i<=N;i++)
	{   
		double x,y,R;
		
		cin>>x>>y;
		point p(x,y);
        R=sqrt(x*x+y*y);
		for(int m=0;;m++)
		{
		if(R<radius(m+1)&&R>radius(m))
		{
			M[i]=m+1;
			break;}
		}
	}
		for(  i=1;i<=N;i++)
			cout<<"property"<<' '<<i<<":"<<' '<<' '<<"This property will begin eroding in year"<<' '<<M[i]<<"."<<endl;
		cout<<"END OF OUTPUT."<<endl;
}




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