一、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.”

二、问题分析

       虽然小弟的英语水平是个半吊子,但这题的意思也太***难以理解了吧。开始的时候我完全理解错了,谢谢几位大哥的留言呐。大体意思:半圆表示一块面积可扩展的区域,开始时,面积是0,在(0,0)处开始以每年50平方米的速度同样呈半圆扩展,输入一个正整数N,然后输入N对坐标,对于每一对坐标值:求出面积扩展到该点的年数,坐标值单位为英里。

      有了中文的翻译这题几乎就没什么了,值得一提的还是精度的问题。由于此题没有什么值得分析的东西,所以就提一些需要注意的地方。

       BigDecimal类:不可变的任意精度的整数。BigDecimal 类提供以下操作:算术、标度操作、舍入、比较、哈希算法和格式转换。toString() 方法提供BigDecimal 的规范表示形式。 这里用到了它的setScale(0, RoundingMode.UP)方法,返回一个
BigDecimal,其标度为指定值,其非标度值通过此BigDecimal 的非标度值乘以或除以十的适当次幂来确定,以维护其总值。如果该操作减少标度,则非标度值必须被除(而不是乘),并且该值可以更改;在这种情况下,将指定的舍入模式应用到除法中。官方解释如上,但小弟至今不明白标度和非标度是什么意思。通俗点讲,第一个参数说明你要多少位小数,第二个参数是在得到第一个参数的值是所使用的舍入规则。就如上面方法中的参数所示,0表示要得到的数是整数,RoundingMode.Up表示远离零方向舍入的舍入模式。RoundingMode是为可能丢弃精度的数值操作指定一种舍入行为,是枚举类型。比如,如果原来的值是0.5,用了这个方法之后,值就变为1.特别注意,舍入是与你所要求的精度有关的。如果你要得精度为1,后面参数的不变,那么值还是0.5.因为0.5已经满足了你的精度要求了,不需要后面的舍入规则了。

      这道题题没什么其他知识了,就是题目晦涩难懂。












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

Poj_1005_I Think I Need A HouseBoat的更多相关文章

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

    I Think I Need a Houseboat Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 85149   Acce ...

  2. I Think I Need a Houseboat 分类: POJ 2015-06-11 17:52 12人阅读 评论(0) 收藏

    I Think I Need a Houseboat Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 92090   Acce ...

  3. [POJ] #1005# I Think I Need a Houseboat : 浮点数运算

    一. 题目 I Think I Need a Houseboat Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 97512 ...

  4. OpenJudge/Poj 1005 I Think I Need a Houseboat

    1.链接地址: http://bailian.openjudge.cn/practice/1005/ http://poj.org/problem?id=1005 2.题目: I Think I Ne ...

  5. 每天一道算法_6_I Think I Need a Houseboat

    今天的题目是I Think I Need a Houseboat 如下: Description Fred Mapper is considering purchasing some land in ...

  6. I Think I Need a Houseboat

    I Think I Need a Houseboat Time Limit : 2000/1000ms (Java/Other)   Memory Limit : 65536/32768K (Java ...

  7. HDU1065 I Think I Need a Houseboat 【数学递推】

    I Think I Need a Houseboat Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Ja ...

  8. I Think I Need a Houseboat POJ - 1005

    I Think I Need a Houseboat POJ - 1005 解题思路:水题 #include <iostream> #include <cstdio> #inc ...

  9. HDU1065 I Think I Need a Houseboat 2016-07-24 13:59 101人阅读 评论(0) 收藏

    I Think I Need a Houseboat Problem Description Fred Mapper is considering purchasing some land in Lo ...

随机推荐

  1. Jenkins--Run shell command in jenkins as root user?

    You need to modify the permission for jenkins user so that you can run the shell commands. You can i ...

  2. SecureCRT的上传和下载

    securtCRT对于后台开发者并不陌生,在windows下是得力的助手.而文件从服务器上上传和下载是很基本.很日常的操作.下面就谈谈关于它的命令及操作: 借助securtCRT,使用linux命令s ...

  3. 相机标准之onvif---开放型网络视频接口论坛onvif 简介

    什么是ONVIF ? ONVIF:原意为 开放型网络视频接口论坛,即 Open Network Video Interface Forum ,是安讯士.博世.索尼等三家公司在2008年共同成立的一个国 ...

  4. onscreen and offscreen

    本文来自stackoverflow一位网友的解答,感觉非常不错就摘录了. --------------------------------------------------------------- ...

  5. 2017-2018-1 20179209《Linux内核原理与分析》第五周作业

    一.实验:使用库函数API和C代码中嵌入汇编代码两种方式使用同一个系统调用 环境说明 实验环境为 Ubuntu16.10 和 实验楼环境. 选择39号系统调用实验.39号系统调用为mkdir系统调用. ...

  6. Android数据格式化

    1.文件大小格式化: Log.d(TAG, Formatter.formatFileSize(this, 100)); //100 B Log.d(TAG, Formatter.formatFileS ...

  7. [TroubleShooting]Neither the partner nor the witness server instance for database is availble

    Problem: You are trying to setup a mirroring on a Database called xxxDB(SQL server 2012). You are ge ...

  8. eclips 创建 maven项目

    Maven安装完成后我们就可以在Eclipse中新建自己的Maven项目了.我们可以在Eclipse中选择new一个project,在出现的对话框中选择Maven目录下的Maven Project. ...

  9. Quartz的misfire理解

    misfire用于Trigger触发时,线程池中没有可用的线程或者调度器关闭了,此时这个Trigger变为misfire.当下次调度器启动或者有可以线程时,会检查处于misfire状态的Trigger ...

  10. CDH版本Hbase二级索引方案Solr key value index

    概述 在Hbase中,表的RowKey 按照字典排序, Region按照RowKey设置split point进行shard,通过这种方式实现的全局.分布式索引. 成为了其成功的最大的砝码. 然而单一 ...