| ||||||||||
| 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 | |||||||||
神 啊,救救我吧!这个程序的结果和答案一样啊 ,怎么就是WRONG ANSWER 啊!#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator