POJ 1005_I Think I Need a Houseboat




#include <iostream>
#include <cmath>
using namespace std;

const float PI = 3.14159;
int main()
{
	int N,NUM;
	float sum = 0, posX, posY, year, radius;
	cin >> N;
	NUM = 0;
	while (N--){
		NUM++;
		cin >> posX >> posY;
		radius = sqrt(posX*posX + posY*posY);
		for (year = 1; sqrt(100.0*year / PI)<radius; year++){
		}
		cout << "Property " << NUM << ": This property will begin eroding in year " << year << "." << endl;
	}
	cout << "END OF OUTPUT." << endl;
	return 0;
}


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章