ZOJ_1049_I Think I Need a Houseboat

debian linux系统安装教程,Debian 10(Buster)安装过程图文详解 Debian 项目发布了它的最新稳定版 Debian 10,其代号是 “Buster”,这个发布版将获得 5 年的支持。Debian 10 可用于 32 位和 64 位系统。这个发布版带来很多新的特色,列出下面一些特色:引入新的 Debian 10 的主题 “FuturePrototype”新版本的电脑桌面环境 GNOME 3.30、Cinnamon 3.8、KDE Plasma 5.14、MAT... 阅读详情
I Think I Need a Houseboat

Time Limit: 2 Seconds      Memory Limit: 65536 KB

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 Format: 

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 Format: 

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.��

Notes: 

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. 


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.




题意:首先看图,每年腐蚀50平方米的面积(比如第i年就腐蚀i*50平方米也就是半圆的面积),Fred的房子在X轴上方的某点,问第几年会腐蚀到,实际上就是问i为什么值得时候Fred的房子坐标(x,y)落入半圆中

思路:就是一数学题,是否在半圆内用距离公式判断就可以了。话说看英文一开始理解题意花了我点时间。。英语也要提高啊。。


Sample program Here

#include<iostream>
#include<math.h>
using namespace std;
const double PI=3.14159;
int main(){
  int n;//表示几组数据
  int r2; //表示半径的平方
  int d2;//表示坐标到原点的距离的平方
  float x,y;
  cin>>n;
  for(int i=0;i<n;i++){
	 int j=1;//用于计数,表示年数
     cin>>x>>y;
	 while(1){
	   r2=(j*100)/PI; //第j年半径的平方
	   d2=pow(x,2)+pow(y,2);
       if( d2<r2 )  break;
	   else j++;	 
	 }
	 cout<<"Property "<<i+1<<": This property will begin eroding in year "<<j<<"."<<endl;
  }

  cout<<"END OF OUTPUT."<<endl;
  return 0;
}




2023推免(夏令营+套实验室)面试总结(博文附问题汇总和参考答案) 阅读详情

相关推荐

别再死磕V1了!手把手教你用WPS Web Office V3 SDK快速集成(附Java Demo避坑指南)

本文详细介绍了如何从WPS Web Office V1迁移到V3版本,重点讲解了V3在性能、安全性和扩展性上的优势,以及Java开发者如何快速集成V3 SDK。文章包含核心功能实现、高级功能适配(如Solon框架)和常见问题排查指南,帮助开发者高效完成迁移并避免常见陷阱。

weixin_27215337的博客 335

【百练】我想我需要一艘船屋(I Think I Need a Houseboat)

描述 弗雷德·马珀(Fred Mapper)正在考虑在路易斯安那州购买一些土地来建造他的房子。在调查土地的过程中,他了解到,由于密西西比河造成的侵蚀,路易斯安那州实际上每年萎缩50平方英里。由于弗雷德希望在他的余生中住在这所房子里,他需要知道他的土地是否会因侵蚀而失去。 在做了更多的研究之后,弗雷德了解到正在失去的土地形成了一个半圆。此半圆是以 (0,0) 为中心的圆的一部分,将圆一分为二的线是 X 轴。X 轴以下的位置位于水中。半圆在第1年初的面积为0。(图中所示为半圆。 输入 输入的第一行将是一个正整数

qq_63683485的博客 582

STM32F103新手必看:0.96寸OLED屏幕从接线到动态显示全攻略(附IIC避坑指南)

本文为STM32F103新手提供了0.96寸OLED屏幕从硬件接线到软件驱动的完整实战指南。重点解析了IIC通信的时序、设备地址(0x78/0x7A)的常见陷阱,并详细演示了如何实现字符显示与平滑滚动显示等动态效果,帮助开发者快速上手并避开常见调试难题。

stone的博客 552

I Think I Need a Houseboat(POJ--1005;OJ--2434

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

zhang_di233的专栏 397

基于CNN对抗嵌入的图像隐写——CNN-Based Adversarial Embedding for Image Steganography

CNN-Based Adversarial Embedding for Image Steganography https://ieeexplore.ieee.org/abstract/document/8603808 这篇论文发表在TIFS( IEEE TRANSACTIONS ON INFORMATION FORENSICS AND SECURITY),TIFS是网络与信息安全领域的国际两大顶级期刊之一,中国计算机学会(CCF)推荐的A类期刊,SCI一区TOP期刊,目前影响因子有7多了。 1 概

weixin_48654804的博客 2278

FreeRTOS CLI实战:5分钟搞定GD32串口终端移植(附LED控制源码)

本文详细介绍了如何在GD32芯片上快速移植FreeRTOS CLI(Command Line Interface)终端,实现串口交互式调试。通过DMA+空闲中断配置和LED控制命令实战,开发者可在5分钟内构建高效嵌入式调试工具,显著提升现场维护效率。

weixin_28707365的博客 450

I Think I Need a Houseboat

        假设你考虑在Louisiana 购买一些土地,并在土地上建设你的家。在对土地的调查中发现,由于Mississppi河的侵蚀,Louisiana州的土地每年减少50平方英里。所以需要知道是否你的土地会因为河流的侵蚀而丧失。         在做了很多的研究后,你发现正在失去的土地构成一个半圆形。这一半圆形是一个圆的一部分,圆心在(0,0),二等分这个圆的线是X轴,X轴下方是水。在第...

LY_624的专栏 447

【从零开始学Skynet】实战篇《球球大作战》(一):功能设计

为了能把之前在基础篇中学习到的Skynet的各种知识结合起来,所以在实战篇中,我们准备开发一个完整的游戏案例《球球大作战》,介绍分布式游戏服务端的实现方法。

我是一条寻水的鱼 2978

I Think I Need a Houseboat(hdu1065水题)

题意:水以每年50平方米半圆形扩散,问多少年扩散到点(x,y); 思路: (0,0) 到(x,y)距离设为r,k年 PI * r * r / 2 = 50*k k = PI * r * r / 100;向上取整,此题有一大坑PI只能取3.1415926,多一位少一位都WA #include #include #include #include using namespace std; co

leonharetd的专栏 746

Waymo数据集里的隐藏彩蛋:5个激光雷达数据融合实战(附Python代码)

本文深入解析Waymo数据集中5个激光雷达的数据融合技术,提供Python实战代码,帮助开发者掌握多传感器协同工作的关键方法。通过时间同步、坐标转换和运动补偿等技术,实现高精度3D场景重建,提升自动驾驶系统的环境感知能力。

weixin_30399821的博客 79

【PyQt】使用PyQt6基于Scenedetect制作视频场景自动分割应用

通过详细介绍PySceneDetect的功能和应用,本文阐释了如何利用这一工具提高视频编辑的效率。我们讨论了安装方法、命令行使用示例以及如何在Python脚本中集成PySceneDetect。此外文章还涵盖了基于PyQt6的图形界面设计,通过多线程技术处理视频,保证界面的响应性,并通过实时反馈机制提升用户体验。无论是专业的视频制作团队还是个人爱好者,PySceneDetect都提供了一种可行的、效率高的场景检测工具,让视频编辑工作变得更加简单快捷。

Mr数据杨 958

POJ1005-I Think I Need a Houseboat

全解题报告索引目录 -> 【北大ACM – POJ试题分类】 转载请注明出处:http://exp-blog.com ------------------------------------------------------------------------- 问题描述: Fred Mapper 正在考虑在路易斯安那州购买一些土地来建他自己的房子。在研究土地的过程中,...

ζёСяêτ - 小優YoU 8771

智能车图像处理0-图像处理整体框架思路

1.总体框架如上所示,具体代码请查看后续文章。2.因为参与竞赛时间是大二,所以在编程中有许多不规范的地方(如变量的命名),大家见谅。3.原创文章,请勿侵权=-=

taiyuezyh的博客 1万+

ZOJ 1049 I Think I Need a Houseboat

这是一道基本题,需要注意的是This property...这句话前面需要输出一个空格,否则会提示“Wrong Answer” C++代码: #include #include #define PI 3.1415927 int main() { int n,year; double x,y,r,S; scanf("%d",&n); for(int i=1;i<=n;i++) {

635

OV9734 DATASHEET,完整规格书

OV9734完整规格书,包括电气参数,尺寸规格,寄存器配置表等

文档:亲测可用解决vnc灰屏,黑屏,鼠标大黑叉情况

主要解决vnc-viewer灰屏,黑屏,鼠标大黑叉等现象,详细见文档。

ZOJ1049-I Think I Need a Houseboat

#include #include const double PI = 3.1415926; int main() { int n; double x, y; int z; double r; double s; scanf("%d", &n); for (int i = 1; i <= n; i++) { s

Collider 457

计算机控制技术及应用

《计算机控制技术及应用》通过总结作者的科研成果和吸收国内外的先进理论、方法和技术,以计算机控制系统的网络化、开放化、智能化和集成化发展趋势为主线索,主要介绍计算机控制系统的基本概念和计算机控制系统的典型形式,计算机控制系统的数学描述与基本分析方法,以及数字PID控制器、最少拍控制系统、达林算法、状态变量设计法等设计方法及其各种改进算法。重点突出计算机控制系统输入输出通道接口的设计方法和典型控制系统的设计案例与实现方法等。

ZOJ Problem Set - 1049 I Think I Need a Houseboat

ZOJ Problem Set - 1049 I Think I Need a Houseboat Time Limit: 2 Seconds                                     Memory Limit: 65536 KB                             Fred Mapper is considerin

Jackwuyongxing的专栏 626

精雕软件(JDpaint) 5.5 绿色版

精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版

ZOJ 1049 &&HDU 1065 I Think I Need a Houseboat

ZOJ 1049 &&HDU 1065 I Think I Need a Houseboat

herongwei 的 BLOG 1122

ZOJ--1049:I Think I Need a Houseboat

水题.... java: import java.util.Scanner; public class I_Think_I_Need_a_Houseboat_1049 { public static void main(String[] args) { double x,y; double pi=3.1415926; int n; Scanner sc=new Scanne

yf224的博客 438

ZOJ Problem Set - 1049 I Think I Need a Houseboat

I Think I Need a Houseboat Time Limit: 2 Seconds      Memory Limit: 65536 KB Fred Mapper is considering purchasing some land in Louisiana to build his house on. In the process of investigating

acm_1361677193的专栏 365

C++ Zoj1049 I Think I Need a Houseboat

题目大意: 判断什么时候50*z(z为年数)形成的半圆,能把给出的(x, y)包含进去,就是(x,y)坐标什么时候能在这个半圆内。 求出这个z 思路: 求以(x,y)-(0,0)为半径,(0,0)为圆心的半圆的面积,然后除以50,向上取整ceil,得到的就是z #include <iostream> #include &...

ChanJose的博客 313

POJ1005 ZOJ1049 I think I need a houseboat

//1_3_1: I think I need a houseboat 河水淹没土地 POJ1005 ZOJ1049 #include #include #include using namespace std; const double pi = 3.1415926; int main() { int tem,N,i = 1; double x,y,ans; scanf("%d",&

223

ZOJ 1049 (I Think I Need a Houseboat)

#include #include const double PI=3.14159; int main() {     using namespace std;     double x,y,r_2;     int N,i=1,year;     cin>>N;     while(N--)     {         cin>>x>>y;         r_2=x*

WuchangI的博客 404
上一篇: ZOJ_1048_Financial Management
下一篇: ZOJ_1051_A New Growth Industry
wankaiming
博客等级 码龄15年 49粉丝 27原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值