Codevs 2621 Land Erosion

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.