POJ 1005 & ZOJ 1049 & UVA 2363

思路:求出在x,y點的面積,除以每年的腐蝕面積,向上取整,使用ceil()函數
#include <iostream>
 
using namespace std;
#define PI 3.141592653
 
 
int main()
{
    int test_num;
    cin >> test_num;
    double x,y;
    double area;
    int year;
    for(int i = 1 ; i <= test_num; i++)
    {
        cin >> x;
        cin >> y;
        area = (x * x + y * y) * PI / 2;
        year = int(area/50)+1;
        cout << "Property " << i <<": This property will begin eroding in year " << year <<"." <<endl;
    }
 
    cout << "END OF OUTPUT" << endl;
} 



發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章