I Think I Need a Houseboat ZOJ(几何计算)

I Think I Need a Houseboat

Time Limit: 2 Seconds Memory Limit: 65536 KB

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 Format:

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 Format:

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.??

Notes:

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.

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.

Source: Mid-Atlantic USA 2001

题意:告诉你半圆形每年以面积50的速度扩展,问你给点的点什么时候会扩展到,转化为计算半径每年扩展多少,什么时候能扩展到给定点到原点的距离。

#include<bits/stdc++.h>
using namespace std;
const int maxn=100;

double dis(double x,double y){
    return x*x+y*y;
}
const double pi=acos(-1.0);
int main()
{
    int T;
    scanf("%d",&T);
    int cas=1;
    while(T--){
            double x,y;
        scanf("%lf%lf",&x,&y);
        double tmp=dis(x,y)*pi/100.0;
        if(floor(tmp+0.5)==tmp)//判断tmp是不是整数
            printf("Property %d: This property will begin eroding in year %d.\n",cas++,(int)tmp);
        else
            printf("Property %d: This property will begin eroding in year %d.\n",cas++,(int)tmp+1);
    }
    puts("END OF OUTPUT.");
    return 0;
}
时间: 2024-08-02 01:21:20

I Think I Need a Houseboat ZOJ(几何计算)的相关文章

UVALive 6092 Catching Shade in Flatland --枚举+几何计算

题意:x=[-200,200],y=[-200,200]的平面,一天中太阳从不同角度射到长椅(原点(0,0))上,有一些树(用圆表示),问哪个时刻(分钟为单位)太阳光线与这些圆所交的弦长总和最长.太阳距离原点总是500m.(这些圆不会互相相交,每个圆都不包括原点或者不经过原点) 解法:直接暴力24*60分钟,找出此时的角度,然后求出直线方程,再枚举每个圆,求出弦长.注意这里每个圆都不包括原点,所以直线与圆的交点一定在同一侧,所以..我当时想多了,没看清题目.把他当成可以包含原点了,代码超长,幸好

poj 2006 Litmus Test 【即zoj 2351:计算酸的PH】

公式:  pH = -log10 [H+]  PH值根据氢离子浓度求出 ,[这里的 [H+] 浓度是摩尔每升为单位的] Ka = [H+] [acid ions] / [acid]   平衡常数K等于分解的氢离子和酸根离子乘积与未分解的酸分子的比值 输入格式:   Ka :常数   ori :初始酸浓度    m :1摩酸分子完全溶解 分解出氢离子数    n :1摩酸分子完全溶解 分解出氢离子数[注意是完全溶解] [这题需要特别注意的是]指数形式是可以直接输入的.如用scanf 或者 prin

1549: Navigition Problem (几何计算+模拟 细节较多)

1549: Navigition Problem Submit Page    Summary    Time Limit: 1 Sec     Memory Limit: 256 Mb     Submitted: 400     Solved: 122 Description Navigation is a field of study that focuses on the process of monitoring and controlling the movement of a cr

ZOJ 3872 计算对答案的贡献

                                               D - Beauty of Array Description Edward has an array A with N integers. He defines the beauty of an array as the summation of all distinct integers in the array. Now Edward wants to know the summation of

点云的基本几何计算

1.计算法向量 2.计算曲率 3.计算点云密度 4.计算点云粗糙度 5.计算点云重心 6.计算点云权重重心 7.计算点云协方差 8.计算点云互协方差

几何计算模板

1 #include <cstdio> 2 #include <cstring> 3 #include <algorithm> 4 #include <cmath> 5 #include <vector> 6 #include <iostream> 7 #include <cassert> 8 9 using namespace std; 10 11 typedef long long lld; 12 13 const d

1.ArcGis几何图形之几何计算

1 /// <summary> 2 /// 检测几何图形A是否包含几何图形B 3 /// </summary> 4 /// <param name="pGeometryA">几何图形A</param> 5 /// <param name="pGeometryB">几何图形B</param> 6 /// <returns>True为包含,False为不包含</returns>

《刘汝佳算法竞赛入门经典》第五章 简单几何计算

The Other Two Trees 另两棵树 没看懂题目,搜了下题解,都是直接给出了简化后的题意和解法...自己再读读原题意吧

计算几何及其应用——解析几何

写在前面:刚学专业课的时候,记得有天突发奇想,心说高三数学的压轴题能不能写个程序跑出答案,这样岂不是解放了数万苦逼高三生的双手?但是当时也仅仅是停留在想法上面,因为高中的解析几何虽然步骤程序化,但是有时候需要灵巧的因式分解,感觉以目前的编程水平还是写不出来,但是了解到数学有一个分支——计算几何,专门利用计算机来进行几何计算的一门科学,并且还与计算机图形学.计算机视觉和图像处理.机器人.计算机辅助设计和制造等高深学科有着联系(摘自<计算几何与应用>导言),所以今天怀着激动的心情开始了这个专题的学