---
title: "POJ1005 I Think I Need a Houseboat"
author: "翼若云"
date: "2012-11-22T10:17:19Z"
tags: []
categories: ["编程语言"]
slug: "poj1005-i-think-i-need-a-houseboat"
draft: false
lastmod: "2012-11-22T13:07:41Z"
id: 1732883
url: "https://feirie.iteye.com/blog/1732883"
---

水题，只要会算半圆面积就能解。其中计算面积可以用Math类中的方法，当时编写图简单就没有使用。

```
double area = Math.PI * (Math.pow(x,2)+Math.pow(y,2)) / 2.0;
```

 

 

```
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner cin=new Scanner(System.in);
        int count = cin.nextInt();
        cin.nextLine();
        for(int idx = 0;idx < count;idx++){
            double x = cin.nextDouble();
            double y = cin.nextDouble();
            double area = 0.5 * 3.1415926 * (x*x+y*y);
            int year = (int)(area/50.0+1);
            System.out.println("Property "+(idx+1)+": This property will begin eroding in year "+year+".");
        }
        System.out.println("END OF OUTPUT.");
    }
}
```