题意:这一题的题意是这个题目考察的重点。有一块区域从圆心开始,河水每年向外侵蚀50平方英里的面积,然后给出建造房子坐标,问需要多少年河水才能淹没到这个地方。侵蚀范围在x轴上。如图
分析:想解决这题其实并不难能够理解上面的题意就很简单了
那么一定会有 π*r²/2 = 50*z ,即 r =√(100*z/π)
贴代码:(184k,0ms)
#include<iostream>
#include<cmath>
using namespace std;
const float pai = 3.14;
int main()
{
int n;
float
x
,
y
,
z;
float
r;
cin
>>n;
int
temp;
temp
= n;
while(n
--)
{
cin
>>
x
>>
y;
for(
z
=
1;;
z
++)
{
r
=
sqrt(
100
*
z
/
pai);
if(
x
*
x
+
y
*
y
<
r
*
r)
break;
}
cout
<<
"Property "
<<
temp
- n
<<
": This property will begin eroding in year "
<<
z
<<
"."
<<
endl;
}
cout
<<
"END OF OUTPUT."
<<
endl;
}
#include<cmath>
using namespace std;
const float pai = 3.14;
int main()
{
}
总结:读这一题的时候花费了不少的时间,不算难题,但是读懂题意也不是特别容易,读懂题目,整个问题也就迎刃而解,同时这一题涉及到了一些简单的数学小知识,不过也算比较简单。