hdu1065 Calculating geometry

Source: Internet
Author: User

Problem Description
Fred Mapper is considering purchasing some land in Louisiana to build he house on. In the process of investigating the land, he learned, and the state of Louisiana are actually shrinking by the square miles Due to erosion caused by the Mississippi River. Since Fred was hoping to live in this House the rest of his life, he needs to know if he land was going to being lost to Erosi On.
After doing more, Fred had learned the land, which is being lost forms a semicircle. This semicircle was part of a circle centered at (0,0) and with the line that bisects the circle being the X axis. Locations below the X axis is in the water. The semicircle has a area of 0 at the beginning of 1. (Semicircle illustrated in the figure.)
Inputthe first line of input would be a positive integer indicating how many data sets would be included (N).
Each of the next N lines would contain the X and Y Cartesian coordinates of the land Fred are considering. These'll is floating point numbers measured in miles. The Y coordinate would be non-negative. (0,0) won't is given. Outputfor each data set, a single line of output should appear. This line should take the form of:
"N:this property would begin eroding in year Z."
Where N is the data set (counting from 1), and Z are the first year (start from 1) This property would be within the SEMICIR CLE at the END of year Z. Z must is an integer.
After the last data set, this should print out "END of OUTPUT."
Notes:
1. No property would appear exactly on the semicircle boundary:it would either be inside or outside.
2. This problem'll 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.
3. All locations is given in miles. Sample INPUT2 1.0 1.0 25.0 0.0 Sample Outputproperty 1:this property would begin eroding in year 1. Property 2:this property would begin eroding in year 20. END of OUTPUT. Analysis: Water problem test instructions is centered on the origin, can erode 50 square miles each year, and then give you a coordinate, ask how many years can be eroded to that point code #include<iostream>
using namespace Std;
#define PI 3.1415926
int main ()
{
int n,i,k;
Double a,b,c,d;
cin>>n;
for (i=1;i<=n;i++) {
cin>>a>>b;
C= (A*A+B*B);
D=C*PI/2/50;
k= (int) d+1;
cout<< "Property" << "<<i<<": ' << ' << ' the property would begin eroding in year "< < ' <<k<< '. ' <<endl;
}
cout<< "END of OUTPUT." <<endl;
return 0;
}

hdu1065 Calculating geometry

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.