HDU 1065 I Think I Need a Houseboat 计算几何

题意:土地按半圆形流逝,每年流逝50平方公里。给出房子的坐标。问,第几年会危及到房子的安全?
思路:

12πr2=50k

r2=100kπ

x2+y2r2=100kπ

k(x2+y2)π100

坑点:令我没想到的是,只有当 π=3.1415926 的时候才能过, π=acos(1) 竟然过不了。

http://acm.hdu.edu.cn/showproblem.php?pid=1065

/*********************************************
    Problem : HDU 1065
    Author  : NMfloat
    InkTime (c) NM . All Rights Reserved .
********************************************/

#include <map>
#include <set>
#include <queue>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <iostream>
#include <algorithm>

#define rep(i,a,b)  for(int i = (a) ; i <= (b) ; i ++)
#define rrep(i,a,b) for(int i = (b) ; i >= (a) ; i --)
#define repE(p,u) for(Edge * p = G[u].first ; p ; p = p -> next)
#define cls(a,x)   memset(a,x,sizeof(a))
#define eps 1e-8

using namespace std;

const int MOD = 1e9+7;
const int INF = 0x3f3f3f3f;
const int MAXN = 1e5+5;
const int MAXE = 2e5+5;

typedef long long LL;
typedef unsigned long long ULL;

int T,n,m,k;
//const double pi = acos(-1.0);
double pi = 3.1415926;

int fx[] = {0,1,-1,0,0};
int fy[] = {0,0,0,-1,1};
double x,y ;
int CASENUM ;

void input() {
    scanf("%lf %lf\n",&x,&y);
}

void solve() {
    int ans = ceil((x*x+y*y)/100*pi);
    printf("Property %d: This property will begin eroding in year %d.\n",++CASENUM,ans);
}

int main(void) {
    //freopen("a.in","r",stdin);
    scanf("%d",&T); while(T--) {
    //while(~scanf("%d %d",&n,&m)) {
    //while(scanf("%d",&n),n) {
        input();
        solve(); 
    }
    puts("END OF OUTPUT.");
    return 0;
}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值