数组B:我想我需要一艘船屋
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
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
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:我想我需要一艘船屋的更多相关文章
- 数组B - 我想我需要一艘船屋
[题目大意]弗雷德先生正在考虑在路易斯安娜州买一块地造房子,在土地调查中,他了解到由于密西西比河的侵蚀,路易斯安那州正以每年50平方英里的速度变小.弗雷德先生想知道他买的那块地是否会被侵蚀掉,经过进一 ...
- [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 ...
- 前端学PHP之数组函数
× 目录 [1]键值操作 [2]记数[3]回调函数[4]组合[5]栈和队列[6]顺序 前面的话 PHP中的数组功能非常强大,数组处理函数有着强大.灵活.高效的特点.PHP5提供了近100个操作数组的系 ...
- 第二章 jQuery数组和字符串
章节内容: 1.利用数组在列表中显示名字 (1)利用数组显示名字列表--join()方法 (2)从数组中获取名字并追加到有序列表--each()方法 (3)利用HTML元素创建数组和计算数组长度--g ...
- JavaScript 数组详解
在程序语言中数组的重要性不言而喻,JavaScript中数组也是最常使用的对象之一,数组是值的有序集合,由于弱类型的原因,JavaScript中数组十分灵活.强大,不像是Java等强类型高级语言数组只 ...
- Delphi数组
参考:http://www.cnblogs.com/huangjacky/archive/2009/12/21/1628833.html 数组就是一堆相同特性数据的一个组合,也就是每个元素的类型必须是 ...
- Scala入门学习笔记三--数组使用
前言 本篇主要讲Scala的Array.BufferArray.List,更多教程请参考:Scala教程 本篇知识点概括 若长度固定则使用Array,若长度可能有 变化则使用ArrayBuffer 提 ...
- {POJ}{树状数组}
总结一下树状数组的题目: {POJ}{3928}{Ping Pong} 非常好的题目,要求寻找一个数组中满足A[i]<A[k]<A[j]的个数,其中i<k<j(或者相反).很巧 ...
- 《疯狂Java:突破程序员基本功的16课》读书笔记-第一章 数组与内存控制
很早以前就听过李刚老师的疯狂java系列很不错,所以最近找一本拿来拜读,再此做下读书笔记,促进更好的消化. 使用Java数组之前必须先对数组对象进行初始化.当数组的所有元素都被分配了合适的内存空间,并 ...
随机推荐
- Nginx实践篇(2)- Nginx作为静态资源web服务 - 控制浏览器缓存、防盗链
一.控制浏览器缓存 1. 浏览器缓存简介 浏览器缓存遵循HTTP协议定义的缓存机制(如:Expires;Cache-control等). 当浏览器无缓存时,请求响应流程 当浏览器有缓存时,请求响应流程 ...
- P3486 [POI2009]KON-Ticket Inspector
啊!这题做的真是爽!除了DP这个方法是有提示的之外,这题居然没有题解,哈哈哈嘿嘿嘿.很自豪的说:全是我自己独立解出来的一道题,包括设计状态,推倒(☺)转移方程,最后记录路径. 好了,首先,我们发现这题 ...
- 基于senparc实现的微信AccessToken接口全局统一获取
在senparc中实现了AccessToken的全局获取方式,因微信项目涉及跨语言.跨团队,外包方式的合作,需要通过接口方式供合作方调用,现将使用webapi实现的接口分享给大家: 1.自定义一个对外 ...
- 斯坦福大学公开课机器学习: advice for applying machine learning | deciding what to try next(revisited)(针对高偏差、高方差问题的解决方法以及隐藏层数的选择)
针对高偏差.高方差问题的解决方法: 1.解决高方差问题的方案:增大训练样本量.缩小特征量.增大lambda值 2.解决高偏差问题的方案:增大特征量.增加多项式特征(比如x1*x2,x1的平方等等).减 ...
- JDK几个高版本的新特性
JDK 高版本的新特性 1.JDK5的新特性: 自动拆装箱 见Integer部分笔记 泛型 增强for循环 静态导入 可变参数 见集合部分笔记 枚举 是指将变量的值一一列出来,变量的值只限于列举出来的 ...
- 格式化MYSQL时间戳函数FROM_UNIXTIME
对MYSQL没有进行过深入的研究,基础知识匮乏,一遇到问题只能手册,看来要把MYSQL的学习安排进时间表了. 函数:FROM_UNIXTIME作用:将MYSQL中以INT(11)存储的时间以" ...
- JSP学习记录
<%@ page contentType="text/html;charset=gb2312" %> <html> <h1>计算器</h1 ...
- 神经网络4_BP神经网络
sklearn实战-乳腺癌细胞数据挖掘(博客主亲自录制视频教程) https://study.163.com/course/introduction.htm?courseId=1005269003&a ...
- Dream team: Stacking for combining classifiers梦之队:组合分类器
sklearn实战-乳腺癌细胞数据挖掘(博主亲自录制视频) https://study.163.com/course/introduction.htm?courseId=1005269003& ...
- JavaSE_坚持读源码_ArrayList对象_Java1.7
底层的数组对象 /** * The array buffer into which the elements of the ArrayList are stored. * The capacity o ...