您的位置:首页 > 其它

POJ 1005 解题报告 I Think I Need a Houseboat

2011-11-27 17:16 387 查看
2011-11-27

好吧,小朋友的数学题。

#include <iostream>
#include <math.h>

using namespace std;

const double PI = atan(1.)*4.;

int getYear(double, double);

int main ()
{
int iInput;
double dX;
double dY;

cin >> iInput;

int iCount = iInput;
while (iInput --)
{
cin >> dX >> dY;
cout << "Property " << iCount - iInput << ": This property will begin eroding in year " << getYear(dX, dY) << "." <<endl;
}

cout << "END OF OUTPUT." << endl;
}

int getYear(double dX, double dY)
{
double dRadius2 = pow(dX, 2) + pow(dY, 2);

double dArea = PI * dRadius2 / 2;

int r = dArea / 50 + 1;
return r;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: