mydjm

 

poj1005

Description

Fred Mapper is considering purchasing some land in Louisiana to build his house on. In the process of investigating the land, he learned that the state of Louisiana is actually shrinking by 50 square miles each year, due to erosion caused by the Mississippi River. Since Fred is hoping to live in this house the rest of his life, he needs to know if his land is going to be lost to erosion.
After doing more research, Fred has learned that the land that is being lost forms a semicircle. This semicircle is part of a circle centered at (0,0), with the line that bisects the circle being the X axis. Locations below the X axis are in the water. The semicircle has an area of 0 at the beginning of year 1. (Semicircle illustrated in the Figure.)

Input

The first line of input will be a positive integer indicating how many data sets will be included (N). Each of the next N lines will contain the X and Y Cartesian coordinates of the land Fred is considering. These will be floating point numbers measured in miles. The Y coordinate will be non-negative. (0,0) will not be given.

Output

For each data set, a single line of output should appear. This line should take the form of: “Property N: This property will begin eroding in year Z.” Where N is the data set (counting from 1), and Z is the first year (start from 1) this property will be within the semicircle AT THE END OF YEAR Z. Z must be an integer. After the last data set, this should print out “END OF OUTPUT.”

Sample Input

2
1.0 1.0
25.0 0.0

Sample Output

Property 1: This property will begin eroding in year 1.
Property 2: This property will begin eroding in year 20.
END OF OUTPUT.
 
 1 #include<stdio.h>
2 #define PI 3.1415926
3 int main()
4 {
5 int n,j,i=0;
6 double x,y;
7 scanf("%d",&n);
8 while(n--)
9 {
10 j=1;
11 scanf("%lf %lf",&x,&y);
12 double sqr=x*x+y*y;
13 while(sqr>((j*100)/PI))
14 {
15 j++;
16 }
17 printf("Property %d: This property will begin eroding in year %d.\n", ++i, j);
18 }
19 printf("END OF OUTPUT.\n");
20 return 0;
21 }

 

 

 

这个也是水题,我用的是比较 我看有人直接除以50 不用比较了~也是一种思维
总结下:
一、我自认英语不错 但是这题具体要求没看懂。。真惭愧。。还百度了下。。有待加强~
二、oj上的题基本都是进一个出一个的。。输入一个出来一个 我想太多了~~
三、一开始写成“j*50” 我把他当成一个圆考虑了 但是在这一步 忘了~~
  半个圆一年加50sm 一个月应该乘以100才对~嗯嗯 
四、开始输出结果对了就很高兴去提交了 结果wa 一看 靠 原来最后的格式都没写上。。太粗心了~
  本来是为了方便。。结果。。呵呵
 

posted on 2011-11-26 19:15  mydjm  阅读(1046)  评论(0编辑  收藏  举报

导航