一道ACM的题,没看懂题目意思,请帮我大概解释一下
这是原题题目网址http://acm.tju.edu.cn/toj/vcontest/showp9050_F.htmlFredMapperisconsideringpur...
这是原题题目网址http://acm.tju.edu.cn/toj/vcontest/showp9050_F.html
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 Format
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 Format
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."
Notes: No property will appear exactly on the semicircle boundary: it will either be inside or outside.This problem will be judged automatically. Your answer must match exactly, including the capitalization, punctuation, and white-space. This includes the periods at the ends of the lines.All locations are given in miles.
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. 展开
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 Format
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 Format
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."
Notes: No property will appear exactly on the semicircle boundary: it will either be inside or outside.This problem will be judged automatically. Your answer must match exactly, including the capitalization, punctuation, and white-space. This includes the periods at the ends of the lines.All locations are given in miles.
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. 展开
2个回答
展开全部
弗莱德考虑购买路易斯安那的土地来建造房子。在调查过程中,他得知路易斯安那州正以每年50平方英里的速度收缩,由于密西西比河的侵蚀。因为弗莱德希望在这所房子里度过余生,他需要知道自己的土地是否将会被侵蚀。
做了更多的研究,弗莱德了解到,失去的土地形成一个半圆。这个半圆形是一个以(0 , 0)为圆心的圆的一部分,x轴把圆一分为二。x轴的下方是在水中。这个半圆在第一年面积为0。(半圆以数字说明。)
输入格式
第一行输入将是一个正整数,表示多少数据集将包括在内(N)。
每下一个N线将包含弗莱德想要的土地的(x,y)笛卡尔坐标。是以英里计量的浮点数。坐标是非负的。(0 , 0)将不给予。
输出格式
对于每个数据集,一个输出线应出现。本线应采取的形式:
“属性N:此属性将开始侵蚀在Z年。”
其中的数据集(从1),并且是第一年(从1开始)此属性在半圆内,到Z年底,Z 必须是整数。
在最后一组数据集之后,应打印出“结束输出。”
注:无属性将出现在半圆上的边界上:它要么是内部或外部。这个问题会自动判断。你的回答必须完全匹配,包括大小写,标点符号和空格。这包括线末尾的部分。所有的位置以英里为单位给出。
样本输入
2
1.0 1.0
25.0 0.0
样例输出
属性1:这个属性将会在第1年开始被侵蚀。
属性2:这个属性将会在第20年开始被侵蚀。
结束输出。
做了更多的研究,弗莱德了解到,失去的土地形成一个半圆。这个半圆形是一个以(0 , 0)为圆心的圆的一部分,x轴把圆一分为二。x轴的下方是在水中。这个半圆在第一年面积为0。(半圆以数字说明。)
输入格式
第一行输入将是一个正整数,表示多少数据集将包括在内(N)。
每下一个N线将包含弗莱德想要的土地的(x,y)笛卡尔坐标。是以英里计量的浮点数。坐标是非负的。(0 , 0)将不给予。
输出格式
对于每个数据集,一个输出线应出现。本线应采取的形式:
“属性N:此属性将开始侵蚀在Z年。”
其中的数据集(从1),并且是第一年(从1开始)此属性在半圆内,到Z年底,Z 必须是整数。
在最后一组数据集之后,应打印出“结束输出。”
注:无属性将出现在半圆上的边界上:它要么是内部或外部。这个问题会自动判断。你的回答必须完全匹配,包括大小写,标点符号和空格。这包括线末尾的部分。所有的位置以英里为单位给出。
样本输入
2
1.0 1.0
25.0 0.0
样例输出
属性1:这个属性将会在第1年开始被侵蚀。
属性2:这个属性将会在第20年开始被侵蚀。
结束输出。
更多追问追答
追问
意思知道了,但是
样本输入
2
1.0 1.0
25.0 0.0
样例输出
属性1:这个属性将会在第1年开始被侵蚀。
属性2:这个属性将会在第20年开始被侵蚀。
这个是根据什么判断出来时第几年开始被侵蚀的呢?
追答
每年侵蚀50平方英里嘛,所以你就算那个点什么时候被侵蚀,也就是什么时候到x轴下面
展开全部
#include <stdio.h>
#include <math.h>
/*double ceil(double x); 功 能: 返回大于或者等于指定表达式的最小整数*/
int main()
{
int count;
double x,y;
scanf("%d",&count);
for(int i=0;i!=count;i++)
{
scanf("%lf %lf",&x,&y);
printf("Property %d: This property will begin eroding in year %d.\n",i+1,(int)ceil((x*x+y*y)*3.14/100));
}
printf("END OF OUTPUT.\n");
return 0;
}
//(x*x+y*y)*3.14/2是求点(x,y)到原点距离的半圆面积 然后再除50 取整 整理后公式就是 (x*x+y*y)*3.14/100)
#include <math.h>
/*double ceil(double x); 功 能: 返回大于或者等于指定表达式的最小整数*/
int main()
{
int count;
double x,y;
scanf("%d",&count);
for(int i=0;i!=count;i++)
{
scanf("%lf %lf",&x,&y);
printf("Property %d: This property will begin eroding in year %d.\n",i+1,(int)ceil((x*x+y*y)*3.14/100));
}
printf("END OF OUTPUT.\n");
return 0;
}
//(x*x+y*y)*3.14/2是求点(x,y)到原点距离的半圆面积 然后再除50 取整 整理后公式就是 (x*x+y*y)*3.14/100)
来自:求助得到的回答
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询