poj 1005 I Think I Need a Houseboat

来源:互联网 发布:百乐官方淘宝授权店 编辑:程序博客网 时间:2024/05/02 02:00

poj 1005  I Think I Need a Houseboat                  题目链接:http://poj.org/problem?id=1005

几何水

题目大意:半圆表示一块面积可扩展的区域,开始时,面积是0,在(0,0)处开始以每年50平方米的速度同样呈半圆扩展,输入一个正整数N,然后输入N对坐标,对于每一对坐标值:求出面积扩展到该点的年数,坐标值单位为米。

题目分析:注意格式、注意用π*r*r算了圆面积后要除的就是100了(半圆)。

以下是代码:

#include<stdio.h>#include<math.h>const double pi=3.141592653589793;int main(){int t,i;double r,x,y;scanf("%d",&t);for(i=1;i<=t;i++){scanf("%lf%lf",&x,&y);r=sqrt(x*x+y*y);printf("Property %d: This property will begin eroding in year %d.\n",i,(int)ceil(pi*r*r/100));}printf("END OF OUTPUT.\n");return 0;}

PS:挺水的,最初看题有点费劲……