Time Limit: 1000MS | Memory Limit: 10000K | |
Total Submissions: 68120 | Accepted: 28722 |
Description
After doing more research, Fred has learned that the land that is being lost forms a semicircle. This semicircle is part of a circle centered at (0,0), with the line that bisects the circle being the X axis. Locations below the X axis are in the water. The semicircle has an area of 0 at the beginning of year 1. (Semicircle illustrated in the Figure.)
Input
Output
Sample Input
2 1.0 1.0 25.0 0.0
Sample Output
Property 1: This property will begin eroding in year 1. Property 2: This property will begin eroding in year 20. END OF OUTPUT.
Hint
2.This problem will be judged automatically. Your answer must match exactly, including the capitalization, punctuation, and white-space. This includes the periods at the ends of the lines.
3.All locations are given in miles.
題目鏈接http://poj.org/problem?id=1005
#include<iostream>
#define pi 3.141592654
using namespace std;
int main()
{
float a,b,n,i,j,s;
int num;
cin>>n;
for(i=0;i<n;i++)
{
cin>>a>>b;
s=pi*(a*a+b*b)/2;
num=s/50;
cout<<"Property "<<i+1<<": "<<"This property will begin eroding in year "<<num+1<<'.'<<endl;
}
cout<<"END OF OUTPUT.";
return 0;
}