题:http://poj.org/problem?id=1005
#include<iostream>
using namespace std;
#define maxn 100000
double ero[maxn];
#define pi 3.141592654
int main()
{
for (int i = 0; i < maxn; i++)
{
ero[i] = 50 * i;
}
int n;
cin >> n;
double a[50][2];
for (int i = 0; i < n; i++)
{
for (int j = 0; j < 2; j++)
{
cin >> a[i][j];
}
}
int *year = new int[n];
for (int i = 0; i < n; i++)
{
year[i] = 0;
}
double *sq = new double[n];
for (int i = 0; i < n; i++)
{
sq[i] = (pi * a[i][0] * a[i][0] + pi * a[i][1] * a[i][1]) / 2;
}
for (int i = 0; i < n; i++)
{
int j = 0;
for (j; ero[j] < sq[i]; j++)
{
j = j;
}
year[i] = j;
}
for (int i = 0; i < n; i++)
{
cout << "Property " << (i + 1) << ": This property will begin eroding in year " << year[i] << "."<<endl;
}
cout << "END OF OUTPUT." << endl;
return 0;