Time Limit: 1000MS | Memory Limit: 10000K | |
Total Submissions: 81874 | Accepted: 35368 |
Description
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
这是一道很简单的计算几何题,本质就是计算点是否在指定的半圆内。
1 /* 2 poj 1000 3 version:1.0 4 author:Knight 5 Email:S.Knight.Work@gmail.com 6 */ 7 8 #include<cstdio> 9 #include<cmath> 10 using namespace std; 11 const double PI = 3.1415926; 12 int main(void) 13 { 14 double S;//被腐蚀陆地的总面积 15 double r;//腐蚀陆地的半径 16 int i,j; 17 int T; 18 double X,Y;//Fred的坐标 19 double Distance;//Fred据坐标原点的距离 20 scanf("%d", &T); 21 for (i=1; i<=T; i++) 22 { 23 scanf("%lf%lf", &X, &Y); 24 Distance = sqrt(X * X + Y * Y); 25 S = 0.0; 26 for (j=1; ; j++) 27 { 28 S += 50.0; 29 r = sqrt(2 * S / PI); 30 if (r >= Distance) 31 { 32 break; 33 } 34 } 35 printf("Property %d: This property will begin eroding in year %d.\n", i, j); 36 } 37 printf("END OF OUTPUT.\n"); 38 return 0; 39 }
[POJ 1005] I Think I Need a Houseboat C++解题
原文:http://www.cnblogs.com/BTMaster/p/3525011.html