`
ysshuai19
  • 浏览: 14933 次
  • 性别: Icon_minigender_1
  • 来自: 西安
最近访客 更多访客>>
文章分类
社区版块
存档分类
最新评论

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

    博客分类:
  • POJ
阅读更多

好吧,小朋友的数学题。

#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;
}
 
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics