Submit Address: http://codevs.cn/problem/2621/
2621 Land Erosion
time limit: 1 sspace limit: 32000 KBtitle level: Golden GoldTitle Description
Description
Fred was thinking about buying some land on the American Louisiana to build his house. In his investigation of the land, he found that Louisiana shrank 50 square miles every year as a result of Mississippi R. erosion. Since Fred intends to spend the rest of his life here, he needs to know if his land will be eroded.
After doing some research, Fred found that the land here was eroded in a semicircular form. This semicircle is a part of a circle, the center of the Circle (0,0), divided by the horizontal axis, the axis of the x axis below the part in the water. The area before the beginning of the first year of the semicircle is 0.
Enter a description
Input Description
One line, with two spaces separated by a number of x, Y, means Fred buys the coordinates of the land used to build the house. These coordinates are floating point types, in miles units and y-coordinates are non-negative and do not appear (0,0).
Output description
Output Description
An integer that represents the year in which Fred's residence began to be eroded.
Sample input
Sample Input
3.0 4.0
Sample output
Sample Output
1
Data range and Tips
Data Size & Hint
(1) The point (x, y) cannot be just on the semicircular boundary; (2) to ensure that your answer is exactly the same as the test data, π=3.141592654 Pi
1#include <cstdio>2#include <iostream>3 4 using namespacestd;5 6 Const DoublePi=3.141592654;7 Doublex,y,s;8 intYear ;9 Ten intMain () One A { -scanf"%LF%LF", &x,&y);//read into the land coordinates of building the house -S= (x*x+y*y) *pi/2.0;//calculate the semi-circle area of land coordinates theYear= (int) (s/ -)+1;//Calculate the answer -printf"%d\n", year); - return 0; -}
Codevs 2621 Land Erosion