题意:土地按半圆形流逝,每年流逝50平方公里。给出房子的坐标。问,第几年会危及到房子的安全?
思路:
12πr2=50k
r2=100kπ
x2+y2≤r2=100kπ
k≥(x2+y2)π100
坑点:令我没想到的是,只有当
π=3.1415926
的时候才能过,
π=acos(−1)
竟然过不了。
http://acm.hdu.edu.cn/showproblem.php?pid=1065
#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;
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) {
scanf("%d",&T); while(T--) {
input();
solve();
}
puts("END OF OUTPUT.");
return 0;
}