Java-POJ1005-I Think I Need a Houseboat

Theft of translation, ha ha ha! White whore gets the job done.

topic:

  Mississippi shore somewhere on land because the river erosion, land area each year are reduced by 50 square miles per year, reducing the land area of the semicircle, the semi-circular area that is growing at a rate of 50 square miles per year. In the first year, the semi-circular area is zero, the coordinates of the center of the semicircle is (0,0), and now the task is given a coordinate, the coordinates obtained at the end of the year which will be the river erosion. Suppose the coordinates of a given distance from the center will not be equal to the radius of the semicircle.
Input:

  The first line number input coordinates, the coordinates of the second line input, one row for each coordinate, each coordinate of the abscissa and ordinate composition, floating point coordinate values, in miles.
Output:

  The coordinates of the output will begin to erode the river at the end of which year. Each output line corresponds to the coordinates, the form: "Property N:. This property will begin eroding in year Z" (N rows, Z), the output after "END OF OUTPUT."

analysis:

 

Code:

 

 1 package poj.ProblemSet;
 2 
 3 import java.util.Scanner;
 4 
 5 public class poj1005 {
 6     public static void main(String[] args) {
 7         Scanner cin=new Scanner(System.in);
 8         double pi=Math.acos(-1);
 9         int n=cin.nextInt();
10         for (int i = 1; i <= n; i++) {
11             double x=cin.nextDouble(),y=cin.nextDouble();
12             int ans=(int)(pi*(x*x+y*y)/100+1);
13             System.out.println("Property "+i+": This property will begin eroding in year "+ans+".");
14         }
15         System.out.println("END OF OUTPUT.");
16     }
17 }
poj1005

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Guess you like

Origin www.cnblogs.com/JasonCow/p/12234474.html