1049 I Think I Need a Houseboat ACM题答案 java版

package arithmetic;

import java.util.Scanner;

public class IThinkI1049 {

public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int num = sc .nextInt();
int years = 0;
double pai=3.1416;
double x=0,y=0;

for(int i=0;i<num;i++){
x=sc.nextDouble();
y=sc.nextDouble();
years = (int) Math.ceil(pai*(x*x+y*y)/100);//因为年数为整数,取不小于该小数的最小整数

System.out.println("Property "+(i+1)+": This property will begin eroding in year "+years+"." );
}

System.out.println("END OF OUTPUT.");

}

}

原文地址:https://www.cnblogs.com/mafang/p/3931727.html