北大ACM(POJ1005-I Think I Need a Houseboat)

Question:http://poj.org/problem?id=1005
问题点:计算半圆面积及向上取整。
 1 Memory: 256K        Time: 0MS
 2 Language: C++        Result: Accepted
 3 
 4 #include <iostream>
 5 
 6 using namespace std;
 7 #define pi 3.1415926
 8 #define Num 200
 9 
10 int main()
11 {
12     int N;
13     double pos[Num][2];
14     cin>>N;
15     for(int i=0;i<N;i++)
16     {
17         cin>>pos[i][0]>>pos[i][1];
18     }
19     for(int i=0;i<N;i++)
20     {
21         cout<<"Property "<<i+1<<": This property will begin eroding in year "<<(int)(pi*(pos[i][0]*pos[i][0]+pos[i][1]*pos[i][1])/100)+1<<"."<<endl;
22     }
23     cout<<"END OF OUTPUT."<<endl;
24     return 0;
25 }

 

posted @ 2016-01-08 13:01  月生丶  阅读(275)  评论(0)    收藏  举报