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.
 

实验代码

#include<stdio.h>
#include<math.h>
#define pi 3.1415927
int main()
{
	int n,i=1;
	int year;
	double x,y,r,s;  //定义浮点型变量,x,y,半径,面积
	scanf("%d",&n);
	while(n--)
	 {
	 	scanf("%lf%lf",&x,&y);
	 	r=x*x+y*y;      //求半径的平方
	 	s=pi*r/2.0;  //求半圆的面积
		year=(int)ceil(s/50.0);  /*ceil函数:返回大于等于表达式的最小整数
		例如:ceil(15.8)=16,ceil(-15.8)=-15*/
		printf("Property %d: This property will begin eroding in year %d.\n",i++,year);
	  }
	  printf("END OF OUTPUT.\n");
	  return 0;
}

  

数组B:我想我需要一艘船屋的更多相关文章

  1. 数组B - 我想我需要一艘船屋

    [题目大意]弗雷德先生正在考虑在路易斯安娜州买一块地造房子,在土地调查中,他了解到由于密西西比河的侵蚀,路易斯安那州正以每年50平方英里的速度变小.弗雷德先生想知道他买的那块地是否会被侵蚀掉,经过进一 ...

  2. [LeetCode] Maximum Size Subarray Sum Equals k 最大子数组之和为k

    Given an array nums and a target value k, find the maximum length of a subarray that sums to k. If t ...

  3. 前端学PHP之数组函数

    × 目录 [1]键值操作 [2]记数[3]回调函数[4]组合[5]栈和队列[6]顺序 前面的话 PHP中的数组功能非常强大,数组处理函数有着强大.灵活.高效的特点.PHP5提供了近100个操作数组的系 ...

  4. 第二章 jQuery数组和字符串

    章节内容: 1.利用数组在列表中显示名字 (1)利用数组显示名字列表--join()方法 (2)从数组中获取名字并追加到有序列表--each()方法 (3)利用HTML元素创建数组和计算数组长度--g ...

  5. JavaScript 数组详解

    在程序语言中数组的重要性不言而喻,JavaScript中数组也是最常使用的对象之一,数组是值的有序集合,由于弱类型的原因,JavaScript中数组十分灵活.强大,不像是Java等强类型高级语言数组只 ...

  6. Delphi数组

    参考:http://www.cnblogs.com/huangjacky/archive/2009/12/21/1628833.html 数组就是一堆相同特性数据的一个组合,也就是每个元素的类型必须是 ...

  7. Scala入门学习笔记三--数组使用

    前言 本篇主要讲Scala的Array.BufferArray.List,更多教程请参考:Scala教程 本篇知识点概括 若长度固定则使用Array,若长度可能有 变化则使用ArrayBuffer 提 ...

  8. {POJ}{树状数组}

    总结一下树状数组的题目: {POJ}{3928}{Ping Pong} 非常好的题目,要求寻找一个数组中满足A[i]<A[k]<A[j]的个数,其中i<k<j(或者相反).很巧 ...

  9. 《疯狂Java:突破程序员基本功的16课》读书笔记-第一章 数组与内存控制

    很早以前就听过李刚老师的疯狂java系列很不错,所以最近找一本拿来拜读,再此做下读书笔记,促进更好的消化. 使用Java数组之前必须先对数组对象进行初始化.当数组的所有元素都被分配了合适的内存空间,并 ...

随机推荐

  1. Docker的脚本安装

    官方镜像支持 curl -sSL https://get.docker.com/ | sh 国内镜像站 curl -sSL https://get.daocloud.io/docker | sh cu ...

  2. QTREE6&&7 - Query on a tree VI &&VII

    树上连通块 不用具体距离,只询问连通块大小或者最大权值 可以类比Qtree5的方法,但是记录东西很多,例如子树有无0/1颜色等 一个trick,两个LCT分离颜色 每个颜色在边上. 仅保留连通块顶部不 ...

  3. A1002. A+B for Polynomials

    This time, you are supposed to find A+B where A and B are two polynomials. Input Each input file con ...

  4. webpack 非严格模式设置 npm i babel-plugin-transform-remove-strict-mode

    安装插件:npm i babel-plugin-transform-remove-strict-mode 在.babelrc文件的插件项添加:"transform-remove-strict ...

  5. c#两个listbox怎么把内容添加到另外个listbox

    https://bbs.csdn.net/topics/392156324?page=1  public partial class Form1 : Form     {         public ...

  6. bash 3

    1)unset 命令可以删除变量.readonly变量不能删除 2)变量类型 运行shell时,会同时存在三种变量: 1) 局部变量 局部变量在脚本或命令中定义,仅在当前shell实例中有效,其他sh ...

  7. HTML学习笔记Day14

    一.移动端页面布局 1.移动端的屏幕尺寸 移动端屏幕尺寸:屏幕对角线的长度,单位是英寸(1英寸=2.45厘米): 常见的尺寸有:2.4,2.8,3.5,3.7,4.2,5.0,5.5,6.0 2.屏幕 ...

  8. (数论 最大公约数 最小公倍数) codeVs 1012 最大公约数和最小公倍数问题

    题目描述 Description 输入二个正整数x0,y0(2<=x0<100000,2<=y0<=1000000),求出满足下列条件的P,Q的个数 条件:  1.P,Q是正整 ...

  9. python自动化开发-[第四天]-函数

    今日概要: - 函数对象 - 函数嵌套 - 命名空间和作用域 - 闭包 - 装饰器 - 迭代器 - 生成器 - 内置函数 一.函数对象 1.函数对象的定义: 函数是第一类对象,即函数可以当作数据传递 ...

  10. FastDFS 分布式文件系统部署实战及基本使用

    FastDFS 分布式文件系统部署实战及基本使用 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. FastDFS是一个开源的高性能分布式文件系统.它的主要功能包括:文件存储,文件同步 ...