OJ百练1005

#include <iostream>
#include <cmath>
using namespace std;
int years(float x, float y)
{
    float r = sqrt(x * x + y * y);
    float square = 3.1415926 * r * r / 2;
    float currentSquare = 0;
    int year = 0;
    while(square >= currentSquare)
    {
        ++year;
        currentSquare += 50;
    }
    return year;
}
int main()
{
    int times;
    int n = 1;
    float x, y;
    cin >> times;
    while(times--)
    {
        cin >> x >> y;
        cout << "Property " << n++ << ":This property will begin eroding in year " << years(x, y) << "."<< endl;
    }
    cout << "END OF OUTPUT." << endl;
    return 0;
}

你可能感兴趣的:(OJ百练1005)