1.题目描述
2.解题思路
好吧,这是个水题,我的目的暂时是把poj第一页刷之,所以水题也写写吧,这个题简单数学常识而已,给定坐标(x,y),易知当圆心为(0,0)时,半圆面积为0.5*PI*(x2+y2),每年侵蚀速度为50,直接除掉取余即可。代码如下:
/*author : lipandate : 2013.07.25email : areslipan@163.com*/#include <iostream>#include <vector>#include <iterator>#define PI 3.141592653589793using namespace std;int main(){int count = 0;vector<int> result;cin >> count;float x,y;for(int i = 0;i < count; ++i){cin >> x >>y;result.push_back((int)((x*x+y*y)*PI*0.5)/50+1);}vector<int>::iterator iter;int i = 1;for(iter = result.begin(); iter!= result.end(); ++iter){cout << "Property "<<i<<": This property will begin eroding in year "<<*iter<<"."<<endl;i++;}cout <<"END OF OUTPUT.";}