POJ 1005 I Think I Need a Houseboat
来源:互联网 发布:淘宝联盟批量链接工具 编辑:程序博客网 时间:2024/06/06 09:36
题目大意:
弗雷德打算在路易斯安那州购置一块土地,经调查研究,该州土地以每年50平方英里的速度被密西西比河侵蚀,侵蚀区域为以半圆(以河岸上的一点为圆心,假设河岸是一条直线),假设圆心在(0, 0),半圆的直边在x轴上,y < 0的部分在河内,y > 0的部分为土地。
现有多个测例(题中会给出测例个数),每个测例中给出(x, y)为弗雷德考虑的地皮的坐标(y ≥ 0,不会给出(0, 0)这样的数据),求该坐标被完全侵蚀的最早年份,假设第1年开始侵蚀(此时侵蚀面积为0),题中数据(坐标、面积等)都为浮点数。
题目链接
注释代码:
/* * Problem ID : POJ 1005 I Think I Need a Houseboat * Author : Lirx.t.Una * Language : GCC * Run Time : 0 ms * Run Memory : 400 KB */#pragma GCC optimize("O2")#include <stdio.h>#include <math.h>//π的值需要精确一点,若只取3.14回WA#definePI3.1415927fintmain() {intnscn, iscn;floatx, y;//弗雷德考虑的地皮的位置坐标scanf("%d", &nscn);iscn = 0;while ( nscn-- ) {scanf("%f%f", &x, &y);printf("Property %d: ", ++iscn);printf("This property will begin eroding in year ");//ceil函数的原型为double ceil(double)//返回的是超过参数表达式值的最小整数//由于返回值为double所以需要强制类型转换printf("%d.\n", (int)ceil( PI * ( x * x + y * y ) / 2 / 50 ));}puts("END OF OUTPUT.");return 0;}无注释代码:
#pragma GCC optimize("O2")#include <stdio.h>#include <math.h>#definePI3.1415927fintmain() {intnscn, iscn;floatx, y;scanf("%d", &nscn);iscn = 0;while ( nscn-- ) {scanf("%f%f", &x, &y);printf("Property %d: ", ++iscn);printf("This property will begin eroding in year ");printf("%d.\n", (int)ceil( PI * ( x * x + y * y ) / 2 / 50 ));}puts("END OF OUTPUT.");return 0;}
单词解释:
houseboat:n, 居住船,游艇
Fred:人名,弗雷德
Mapper:人名
mapper:n, 映射,制图人
purchase:vt, 购买
Lousiana:n, 地名,美国路易斯安那州
investigate:vt, 调查研究
in the process of:在.....的过程中
shrink:vt, 收缩,猥琐
erosion:n, 侵蚀,腐蚀
Mississippi:n, 地名,美国密西西比河,密西西比州
semicircle:n, 半圆形
bisect:vt, 平分
axis:n, 轴线
Descartes:人名,笛卡尔
Cartesian:adj, 笛卡尔的
coordinate:n, 坐标
Cartesian coordinate:n, 笛卡尔坐标
boundary:n, 边界
capitalization:n, 大小写,资本化
punctuation:n, 标点符号
property:n, 财产,属性
0 0
- POJ - I Think I Need a Houseboat
- POJ-I Think I Need a Houseboat
- poj 1005 I Think I Need a Houseboat
- POJ 1005 I Think I Need a Houseboat
- (POJ 1005)I Think I Need a Houseboat
- POJ 1005 解题报告 I Think I Need a Houseboat
- 【POJ】1005 I Think I Need a Houseboat
- POJ 1005I Think I Need a Houseboat
- poj-1005 I Think I Need a Houseboat
- [POJ]1005 I Think I Need a Houseboat
- POJ 1005 I Think I Need a Houseboat
- POJ-1005 I Think I Need a Houseboat解题报告
- poj 1005 I Think I Need a Houseboat
- poj 1005 I Think I Need a Houseboat
- POJ 1005 I Think I Need a Houseboat
- poj 1005 I Think I Need a Houseboat
- POJ-1005-I Think I Need a Houseboat
- poj 1005 I Think I Need a Houseboat
- 关于公交系统中运用NFC-TSM技术进行移动支付的解决案例浅析
- 正则表达式(二)
- 详解Cocos2d-X中宏CC_DLL
- hdu 1702 ACboy needs your help again
- Linux vsftp服务的安装
- POJ 1005 I Think I Need a Houseboat
- hdu 2044 (水题)
- 二分总结一 二分法试解 POJ1064
- Linux vi编辑器的基本命令
- ubuntu13.10 多系统安装
- Linux 搭建svn服务器
- 利用反射泛型编写一个通用Dao
- Linux yum详解
- poj 1028 Web Navigation