描述(poj1005)
输入
输出
样例输入
2 1.0 1.0 25.0 0.0
样例输出
Property 1: This property will begin eroding in year 1. Property 2: This property will begin eroding in year 20. END OF OUTPUT.
package demo1005; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner input = new Scanner(System.in); while(input.hasNext()) { int n = input.nextInt(); for(int i=0;i<n;i++) { double x = input.nextFloat(); double y = input.nextFloat(); double s = Math.PI*(Math.pow(x, 2)+Math.pow(y, 2))/2; int count=0; while(s>0) { s=s-50; count++; } System.out.println("Property " + i + ": This property will begin eroding in year " + count+"."); } System.out.println("END OF OUTPUT."); } } }
原文:http://www.cnblogs.com/aicpcode/p/4252163.html