POJ-1005: I Think I Need a Houseboat 详解1: 直接计算

> 分析

>> 本题主要在于理解题意

>> 半圆的范围在多少年内会包含给的坐标

> 注意

>> 算式一口气会稍微快一点

> 附代码

 1 #include "stdio.h"
 2
 3 #define PI 3.14f
 4
 5 int main(void)
 6 {
 7     int n = 0 ;
 8     int i = 0 ;
 9     float x = 0.0, y = 0.0;
10     int years = 0 ;
11
12     scanf("%d", &n) ;
13
14     for(i = 0; i < n; i++)
15     {
16         scanf("%f %f", &x, &y) ;
17         years = (int)(PI * (x * x + y * y) / 2 / 50) + 1;
18
19         printf("Property %d: This property will begin eroding in year %d.\r\n",
20             i + 1, years) ;
21     }
22
23     printf("END OF OUTPUT.\r\n") ;
24     return 0 ;
25 }
时间: 2024-10-13 18:11:53

POJ-1005: I Think I Need a Houseboat 详解1: 直接计算的相关文章

poj 1005:I Think I Need a Houseboat(水题,模拟)

I Think I Need a Houseboat Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 85149   Accepted: 36857 Description Fred Mapper is considering purchasing some land in Louisiana to build his house on. In the process of investigating the land,

POJ 1005 I Think I Need a Houseboat 水

 I Think I Need a Houseboat Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 92807   Accepted: 40360 Description Fred Mapper is considering purchasing some land in Louisiana to build his house on. In the process of investigating the lan

poj 1005 I Think I Need a Houseboat

1 #include <iostream> 2 using namespace std; 3 const double pi = 3.1415926535; 4 5 int main() 6 { 7 int t,time = 0;; 8 double x,y; 9 cin >> t; 10 while(t--) 11 { 12 ++time; 13 cin >> x >> y; 14 double area = pi*(x*x + y*y); 15 int

POJ 1659 Frogs&#39; Neighborhood(可图性判定—Havel-Hakimi定理)【超详解】

Frogs' Neighborhood Time Limit: 5000MS   Memory Limit: 10000K Total Submissions: 9897   Accepted: 4137   Special Judge Description 未名湖附近共有N个大小湖泊L1, L2, ..., Ln(其中包括未名湖),每个湖泊Li里住着一只青蛙Fi(1 ≤ i ≤ N).如果湖泊Li和Lj之间有水路相连,则青蛙Fi和Fj互称为邻居.现在已知每只青蛙的邻居数目x1, x2, ..

poj 1611(详解)

The Suspects Time Limit: 1000MS   Memory Limit: 20000K Total Submissions: 22217   Accepted: 10805 Description Severe acute respiratory syndrome (SARS), an atypical pneumonia of unknown aetiology, was recognized as a global threat in mid-March 2003. T

poj 1942(详解)

Paths on a Grid Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 21439   Accepted: 5259 Description Imagine you are attending your math lesson at school. Once again, you are bored because your teacher tells things that you already mastere

poj 1005(π的反三角)

我太菜了 只能水水题维持生活这样子 I Think I Need a Houseboat Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 113609   Accepted: 49040 Description Fred Mapper is considering purchasing some land in Louisiana to build his house on. In the process of inves

Poj 1005

刚开始的时候下意识想把坐标半径和每一年淹没的半径求出来做比较-- 1 #include<iostream> 2 #define pi 3.14159265 3 using namespace std; 4 int main(){ 5 int N; 6 double x,y; 7 int year; 8 cin>>N; 9 for(int i=0;i<N;i++){ 10 cin>>x>>y; 11 year=pi*(x*x+y*y)/100+1; 12

POJ 1005 解题报告

题意就是,有一块半圆形区域,从0,0点开始向四周扩展,每年扩展50.0面积(单位统一不用考虑). 计算给定点在第几年结束之前被圆形区域覆盖. 我的思路: 1.计算以给定点到原点长度的半径做半圆的面积. 2.除以50.0,所得结果加1,就是所求 PI取3.14159265 #include<iostream> #include<string> using namespace std; int main() { double x, y; int n; const double PI =