POJ. 1005 I Think I Need a Houseboat(水 )
代码总览
#include <cstdio>
#include <cstring>
#include <cmath>
#include <queue>
#include <stack>
#include <vector>
#define nmax
using namespace std;
const double pi = acos(-1);
int main()
{
double x,y ;
int n;
scanf("%d",&n);
for(int i =1;i<=n;++i){
scanf("%lf %lf" ,&x,&y);
double rf = x*x + y*y;
double area = pi*rf /2;
printf("Property %d: This property will begin eroding in year %d.\n",i,(int)ceil(area / 50.0));
}
printf("END OF OUTPUT.\n");
return 0;
}
本文提供了一段用于解决POJ.1005问题的C++代码,该问题要求根据输入的坐标计算房屋开始遭受侵蚀的年份。通过计算圆的面积并除以侵蚀速度来确定所需年数。
1141

被折叠的 条评论
为什么被折叠?



