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. 【洛谷P3917】异或序列

    题目大意:给定一个长度为 N 的序列,每个位置有一个权值,求 \[\sum\limits_{1\le i\le j\le n}(a_i\oplus a_{i+1}...\oplus a_j)\] 的值 ...

  2. Django(十七)文件上传

    http://www.cnblogs.com/wupeiqi/articles/5703697.html - 文件上传        - 普通上传        - 自定义页面上传按钮        ...

  3. Java 接口篇

    为什么使用接口? 问题 要求实现防盗门的功能 分析 门有开和关的功能,锁有上锁和开锁的功能 将门和锁分别定义为抽奖类 那么问题就是防盗门即继承了门的同时又继承了锁,而Java的继承是单继承,接口可多继 ...

  4. jasperreport

     我们的报表要用FusionCharts.jasperreport

  5. 中性SNP的突变年龄评估(estimate the average age of a neutral two-allele polymorphism)

    假设中性突变的频率分别为P和1-P,则其突变年龄为:-4Ne[p*( logep)+(1-p)* loge (1-p)] The average age of a neutral two-allele ...

  6. SpringCloud-初识

    说道SpringCloud,原来就去了解过,也有很大兴趣,只是当初不知道这是个什么东西.在它之前,我学习Spring,在官网肆无忌惮的逛的时候,发现了SpringBoot,那个时候就打算开始学习Spr ...

  7. POJ 2253 Frogger (Floyd)

    Frogger Time Limit: 1000MS   Memory Limit: 65536K Total Submissions:57696   Accepted: 18104 Descript ...

  8. noi.openjudge 1.13.15

    http://noi.openjudge.cn/ch0113/15/ 总时间限制:  1000ms 内存限制:  65536kB 描述 输入一个长度为N的整数序列 (不多于128个整数),每个整数的范 ...

  9. keepalived初次安装体验

    keepalived主要有两大功能,一个是LB,一个是VRRP+failover,其中LB功能和LVS的功能类似,都是通过在LB上配置RS,监控RS的状态,将从client来的请求发送给对应算法的RS ...

  10. 关于indexOf,charAt,subString的区别

    @Test public void indexOf() { // 注意:在Unicode表中A-Z的十进制对应:65-90 // a-z的进制对应:97-122 // 0-9的十进制对应:48-57 ...