Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

Re:留念一下

Posted by outsky at 2009-11-04 13:54:49 on Problem 1005
In Reply To:留念一下 Posted by:Godwind at 2009-09-10 15:38:40
#include <iostream>
using namespace std;

double GetR2(int year)
{
    if(year == 0)
    {
        return 0;
    }
    else
    {
        return 100/3.14159 + GetR2(year-1);
    }
}

int GetZ(double doubleR)
{
    for(int i=1; true; ++i)
    {
        if(GetR2(i) >= doubleR)
        {
            return i;
        }
    }
}

int main()
{
    int m = 0;
    cin >> m;

    double x, y;
    x = y = 0.0;
    for(int i=0; i<m; ++i)
    {
        cin >> x >> y;

        cout << "Property " << i+1 << ": This property will begin eroding in year " << GetZ(x*x + y*y) << "." << endl;
    }
    cout << "END OF OUTPUT." << endl;

    return 0;
}

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator