package Poj1005_map; import java.util.Scanner; public class Poj1005 { private static final float PI = (float) 3.1415926; public static void main(String[] args) throws Exception{ // TODO Auto-generated method stub Scanner cin = new Scanner(System.in); int setnum = cin.nextInt(); float[] x; float[] y; x = new float[setnum]; y = new float[setnum]; for(int i=0;i<setnum;i++){ x[i] = (float) cin.nextFloat(); y[i] = (float) cin.nextFloat(); } for(int j=0;j<setnum;j++) System.out.println("Property " + (j+1) + ": " + "This property will begin eroding in year " + caculateYear(x[j],y[j]) + "."); System.out.println("END OF OUTPUT."); } public static int caculateYear(float x, float y){ float dis = 0,r = 0; int year=1; dis = (float) Math.sqrt(x*x+y*y); while(r<dis){ r = (float) Math.sqrt(50*2*year/PI); year++; } return year-1; } }