当前位置: 首页 > news >正文

POJ 1005 I Think I Need a Houseboat

2019独角兽企业重金招聘Python工程师标准>>> hot3.png

I Think I Need a Houseboat

Time Limit: 1000MS Memory Limit: 10000K

Total Submissions: 95599 Accepted: 41622

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

import java.util.*;

public class Main {
	public static void main(String[] args) {

		Scanner cin = new Scanner(System.in);
		int n = cin.nextInt();

		float x = 0.0f;
		float y = 0.0f;

		for (int i = 1; i <= n; i++) {
			x = cin.nextFloat();
			y = cin.nextFloat();
			double z = Math.PI * (Math.pow(x, 2) + Math.pow(y, 2)) / (50 * 2);
			int year = (int) Math.ceil(z);
			// Property 1: This property will begin eroding in year 1.
			System.out.println("Property " + i
					+ ": This property will begin eroding in year " + year
					+ ".");
		}
		System.out.println("END OF OUTPUT.");
		cin.close();
	}
}


转载于:https://my.oschina.net/u/553266/blog/620725

相关文章:

  • compileDebugJavaWithJavac
  • OSI七层与TCP/IP四层模型
  • 3-9-模拟银行排队过程-栈和队列-第3章-《数据结构》课本源码-严蔚敏吴伟民版...
  • 《从零开始学Swift》学习笔记(Day 24)——枚举(Day 24)——枚举
  • 日志管理
  • 初探验证码识别
  • HttpClient4.5教程-基础 1.1
  • Spring的IoC容器(转)BeanFactory
  • 最短路问题------分别用深搜和广搜去解题
  • linux ps 查看耗cpu高的线程
  • LVS-NAT 模式配置
  • 堆内存与栈内存
  • [分享]iOS开发-关于在xcode中引用文件夹右边出现问号的解决办法
  • shell中的特殊符号
  • zookeeper环境搭建中的几个坑[Error contacting service. It is probably not running]的分析及解决...
  • 【347天】每日项目总结系列085(2018.01.18)
  • 345-反转字符串中的元音字母
  • Angularjs之国际化
  • Babel配置的不完全指南
  • create-react-app项目添加less配置
  • exif信息对照
  • Java精华积累:初学者都应该搞懂的问题
  • mongo索引构建
  • Netty源码解析1-Buffer
  • October CMS - 快速入门 9 Images And Galleries
  • Spark RDD学习: aggregate函数
  • Webpack入门之遇到的那些坑,系列示例Demo
  • 对JS继承的一点思考
  • 配置 PM2 实现代码自动发布
  • 如何将自己的网站分享到QQ空间,微信,微博等等
  • 少走弯路,给Java 1~5 年程序员的建议
  • 设计模式走一遍---观察者模式
  • 腾讯优测优分享 | 你是否体验过Android手机插入耳机后仍外放的尴尬?
  • 小程序 setData 学问多
  • 用mpvue开发微信小程序
  • 自制字幕遮挡器
  • 如何在 Intellij IDEA 更高效地将应用部署到容器服务 Kubernetes ...
  • ​LeetCode解法汇总1276. 不浪费原料的汉堡制作方案
  • ​VRRP 虚拟路由冗余协议(华为)
  • ​渐进式Web应用PWA的未来
  • ​无人机石油管道巡检方案新亮点:灵活准确又高效
  • # 深度解析 Socket 与 WebSocket:原理、区别与应用
  • #stm32驱动外设模块总结w5500模块
  • (1) caustics\
  • (day 2)JavaScript学习笔记(基础之变量、常量和注释)
  • (M)unity2D敌人的创建、人物属性设置,遇敌掉血
  • (Mac上)使用Python进行matplotlib 画图时,中文显示不出来
  • (二)构建dubbo分布式平台-平台功能导图
  • (附源码)SSM环卫人员管理平台 计算机毕设36412
  • (九)信息融合方式简介
  • (六)激光线扫描-三维重建
  • (转)c++ std::pair 与 std::make
  • ./include/caffe/util/cudnn.hpp: In function ‘const char* cudnnGetErrorString(cudnnStatus_t)’: ./incl
  • .htaccess 强制https 单独排除某个目录
  • .net core 6 使用注解自动注入实例,无需构造注入 autowrite4net