ACM —— 1005 I Think I Need a Houseboat

解题代码:

import java.util.Scanner;

public class Main {

	public final static float PI = 3.1415926f;
	public static void main(String[] args) {
		Scanner stdin = new Scanner(System.in);
		int num = stdin.nextInt();
		float x,y;
		int nYears = 0;
		for (int i = 0; i < num; i++) {
			if (stdin.hasNextLine()) {
				x = stdin.nextFloat();
				y = stdin.nextFloat();
				nYears = (int) ((x*x + y*y)*PI/100.0);
			}
			System.out.printf("Property %d: This property will begin eroding in year %d.\n", i+1,nYears+1);
		}
		System.out.println("END OF OUTPUT.");
	}

}


 

猜你喜欢

转载自blog.csdn.net/WYYZ5/article/details/48269761