一、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. Spark源码分析之一:Job提交运行总流程概述

    Spark是一个基于内存的分布式计算框架,运行在其上的应用程序,按照Action被划分为一个个Job,而Job提交运行的总流程,大致分为两个阶段: 1.Stage划分与提交 (1)Job按照RDD之间 ...

  2. 必会必知git

    git必会必知   1 前言 git前身是BitKeeper,但是他不是开源软件,不符合当时开源趋势,于是就会有了开源的git,git开发只用了十天时间.目前git是公司开发必不可少的一个工具,用于多 ...

  3. centOS中如何修改运行级别!

    在图形化界面可以用Ctrl+Alt+F2进入命令行窗口 * 假如你使用了虚拟机,有可能会出现不能进去的问题,原因是因为热键冲突 * 解决办法:修改热键就行了 edit→parameter→hot ke ...

  4. CountDownTimer

    package com.daoge.widget; import java.text.DecimalFormat; import android.os.CountDownTimer; import a ...

  5. iOS - web自适应宽高(预设置的大小)

    //web自适应宽高 -(void)webViewDidFinishLoad:(UIWebView *)webView { NSLog(@"wessd"); [ webView s ...

  6. Android 事件分发机制 图解

    在Android 开发中事件分发是比较重要的,也是比较难理解的,之前看过这方面的东西,以为自己弄懂了,也就没太注意,最近面试呢,想着肯定要问到这一块的东西,回顾的时候发现又忘了,真是好记性不如烂笔头啊 ...

  7. spring事务和mysql的隔离级别

    mysql事务.mysql隔离级别.mysql锁.mysql数据一致性.Spring事务.Spring事务传播性之间的关系 一直有些模糊,整理一下.   mysql事务: 在mysql中,只有使用了I ...

  8. a positive definite matrix

    https://en.wikipedia.org/wiki/Definite_quadratic_form https://www.math.utah.edu/~zwick/Classes/Fall2 ...

  9. 远程服务器上的weblogic项目管理(一)项目部署与更新流程

    最近接手了项目组的服务器管理工作,服务器以linux系统为主,项目则搭建在weblogic上面,也算是积累了一些远程管理服务器的心得,决定稍微整理一下: windows系统要如何方便地连接到远程服务器 ...

  10. Java集合(一):Java集合概述

    注:本文基于JDK 1.7 1 概述 Java提供了一个丰富的集合框架,这个集合框架包括了很多接口.虚拟类和实现类. 这些接口和类提供了丰富的功能.可以满足主要的聚合需求. 下图就是这个框架的总体结构 ...