【 OJ 】 HDOJ1065 求土地被淹的时间[ 56 ]

emmm.....(:微笑

AC代码:

# include
# include
#define PI 3.1415926
#define s 100  // 半圆50 圆100
using namespace std;
int main(void) {
	//圆面积公式  πR^2   R=sqrt(x*x+y*y)  每年圆面积增加50平方
	int N, year,index=0;
	double R, S,x,y;
	cin >> N;
	while (N--) {
		cin >> x >> y;
		S = PI*(x*x + y*y);//总面积  
		year = S / s + 1;// 不加1少一年,我也不懂= =.
		cout << "Property " << ++index << ": This property will begin eroding in year " << year << "." << endl;
	}
	cout << "END OF OUTPUT." << endl;
	system("pause");
	return 0;
}

 

你可能感兴趣的:(HDOJ,模拟)