读书人

joj 1085: I Think I Need a Houseboa

发布时间: 2012-11-08 08:48:11 作者: rapoo

joj 1085: I Think I Need a Houseboat 半圆形侵蚀

1085: I Think I Need a Houseboat
ResultTIME LimitMEMORY LimitRun TimesAC TimesJUDGEjoj 1085: I Think I Need a Houseboat 半圆侵蚀3s8192K1364522Standard


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

OutputFor 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.?

4. PI = 3.1415

Sample Input
21.0 1.025.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算多少年后会把这个半圆形给侵蚀掉*/#include <stdio.h>#define PI 3.1415int main(){double x,y,sum;int time;scanf("%d",&time);for(int i=0;i<time;i++){//scanf("%f%f",&x,&y);//这个是不可以的scanf("%lf%lf",&x,&y);sum = PI* (x*x + y*y)/2;int year = 0;double lost = 0.0;while(lost < sum){lost += 50;year +=1;}printf("Property %d: This property will begin eroding in year %d.\n",i+1,year);}printf("END OF OUTPUT.\n");//别忘了return 0;}

读书人网 >编程

热点推荐