POJ 1005 I Think I Need a Houseboat 水



I Think I Need a Houseboat

Time Limit: 1000MS   Memory Limit: 10000K
Total Submissions: 92807   Accepted: 40360

Description

Fred Mapper is considering purchasing some land in Louisiana to build his house on. In the process of investigating the land, he learned that the state of Louisiana is actually shrinking by 50 square miles each year, due to erosion
caused by the Mississippi River. Since Fred is hoping to live in this house the rest of his life, he needs to know if his land is going to be lost to erosion.

After doing more research, Fred has learned that the land that is being lost forms a semicircle. This semicircle is part of a circle centered at (0,0), with the line that bisects the circle being the X axis. Locations below the X axis are in the water. The
semicircle has an area of 0 at the beginning of year 1. (Semicircle illustrated in the Figure.)

Input

The first line of input will be a positive integer indicating how many data sets will be included (N). Each of the next N lines will contain the X and Y Cartesian coordinates of the land Fred is considering. These will be floating
point numbers measured in miles. The Y coordinate will be non-negative. (0,0) will not be given.

Output

For each data set, a single line of output should appear. This line should take the form of: “Property N: This property will begin eroding in year Z.” Where N is the data set (counting from 1), and Z is the first year (start from
1) this property will be within the semicircle AT THE END OF YEAR Z. Z must be an integer. After the last data set, this should print out “END OF OUTPUT.”

Sample Input

2
1.0 1.0
25.0 0.0
Sample Output
Property 1: This property will begin eroding in year 1.
Property 2: This property will begin eroding in year 20.
END OF OUTPUT.
Hint
1.No property will appear exactly on the semicircle boundary: it will either be inside or outside.
2.This problem will be judged automatically. Your answer must match exactly, including the capitalization, punctuation, and white-space. This includes the periods at the ends of the lines.
3.All locations are given in miles. 
Source
Mid-Atlantic 2001
 AC代码:
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#define pi 3.14159265358979323846
using namespace std;
int main(){
    int n;
    cin>>n;
    float x,y;
    double calc;
    int i=0,j;
    while(n--){
        i++;
        cin>>x>>y;
        calc=(x*x+y*y)*pi/2/50;
        printf("Property %d: This property will begin eroding in year %d.\n",i,j=ceil(calc));
    }
    printf("END OF OUTPUT.\n");
    return 0;
}

版权声明:本文为博主原创文章,未经博主允许不得转载。

时间: 2024-10-16 08:44:08

POJ 1005 I Think I Need a Houseboat 水的相关文章

poj 1005:I Think I Need a Houseboat(水题,模拟)

I Think I Need a Houseboat Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 85149   Accepted: 36857 Description Fred Mapper is considering purchasing some land in Louisiana to build his house on. In the process of investigating the land,

poj 1005 I Think I Need a Houseboat

1 #include <iostream> 2 using namespace std; 3 const double pi = 3.1415926535; 4 5 int main() 6 { 7 int t,time = 0;; 8 double x,y; 9 cin >> t; 10 while(t--) 11 { 12 ++time; 13 cin >> x >> y; 14 double area = pi*(x*x + y*y); 15 int

POJ 1269 Intersecting Lines(线段相交,水题)

Intersecting Lines 大意:给你两条直线的坐标,判断两条直线是否共线.平行.相交,若相交,求出交点. 思路:线段相交判断.求交点的水题,没什么好说的. struct Point{ double x, y; } ; struct Line{ Point a, b; } A, B; double xmult(Point p1, Point p2, Point p) { return (p1.x-p.x)*(p2.y-p.y)-(p1.y-p.y)*(p2.x-p.x); } bool

POJ - 3006 - Dirichlet&#39;s Theorem on Arithmetic Progressions = 水题

http://poj.org/problem?id=3006 给一个等差数列,求其中的第n个质数,答案保证不超过1e6.n还特别小?!!! 埃筛之后暴力. #include<algorithm> #include<cmath> #include<cstdio> #include<cstring> #include<iostream> #include<map> #include<set> #include<stack

poj 1005(π的反三角)

我太菜了 只能水水题维持生活这样子 I Think I Need a Houseboat Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 113609   Accepted: 49040 Description Fred Mapper is considering purchasing some land in Louisiana to build his house on. In the process of inves

Poj 1005

刚开始的时候下意识想把坐标半径和每一年淹没的半径求出来做比较-- 1 #include<iostream> 2 #define pi 3.14159265 3 using namespace std; 4 int main(){ 5 int N; 6 double x,y; 7 int year; 8 cin>>N; 9 for(int i=0;i<N;i++){ 10 cin>>x>>y; 11 year=pi*(x*x+y*y)/100+1; 12

POJ 1005 解题报告

题意就是,有一块半圆形区域,从0,0点开始向四周扩展,每年扩展50.0面积(单位统一不用考虑). 计算给定点在第几年结束之前被圆形区域覆盖. 我的思路: 1.计算以给定点到原点长度的半径做半圆的面积. 2.除以50.0,所得结果加1,就是所求 PI取3.14159265 #include<iostream> #include<string> using namespace std; int main() { double x, y; int n; const double PI =

1005 i think i need a houseboat

在测评系统好几次没有输出成功的原因是printf()中少了空格. #include<iostream> #include<cstdio> #include<cmath> const double pi=3.1415926; using namespace std; int main(){ double x,y; int T; int t,h=1; cin>>T; while(h<=T){ t=1; cin>>x>>y; doub

POJ 2195 一人一房 最小费用流 建图 水题

Going Home Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 21010   Accepted: 10614 Description On a grid map there are n little men and n houses. In each unit time, every little man can move one unit step, either horizontally, or vertica