整数返回poj1005——I Think I Need a Houseboat
生活随笔
收集整理的這篇文章主要介紹了
整数返回poj1005——I Think I Need a Houseboat
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
這兩天一直在研究整數(shù)返回之類的問題,上午正好有機會和大家討論一下.
????原題:
????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 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
每日一道理站在歷史的海岸漫溯那一道道歷史溝渠:楚大夫沉吟澤畔,九死不悔;魏武帝揚鞭東指,壯心不已;陶淵明悠然南山,飲酒采菊……他們選擇了永恒,縱然諂媚誣蔑視聽,也不隨其流揚其波,這是執(zhí)著的選擇;縱然馬革裹尸,魂歸狼煙,也要仰天長笑,這是豪壯的選擇;縱然一身清苦,終日難飽,也愿怡然自樂,躬耕隴畝,這是高雅的選擇。在一番選擇中,帝王將相成其蓋世偉業(yè),賢士遷客成其千古文章。
????
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.1415926 int main() {int n;scanf("%d",&n);for(int i=1; i<=n; i++){double x,y;scanf("%lf%lf",&x,&y);int s=ceil(PI*(x*x+y*y)/100.0);printf("Property %d: This property will begin eroding in year %d.\n",i,s);//ceil數(shù)函:返回大于或者即是指定表達式的最小整數(shù)}printf("END OF OUTPUT.\n");return 0; }????
?
文章結(jié)束給大家分享下程序員的一些笑話語錄: 某程序員對書法十分感興趣,退休后決定在這方面有所建樹。花重金購買了上等的文房四寶。一日突生雅興,一番磨墨擬紙,并點上了上好的檀香,頗有王羲之風(fēng) 范,又具顏真卿氣勢,定神片刻,潑墨揮毫,鄭重地寫下一行字:hello world.
轉(zhuǎn)載于:https://www.cnblogs.com/jiangu66/archive/2013/05/04/3059984.html
創(chuàng)作挑戰(zhàn)賽新人創(chuàng)作獎勵來咯,堅持創(chuàng)作打卡瓜分現(xiàn)金大獎總結(jié)
以上是生活随笔為你收集整理的整数返回poj1005——I Think I Need a Houseboat的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: TDD:MS自带的单元测试 之 线程模型
- 下一篇: Linux C中发现无法连接到math.