码迷,mamicode.com
首页 > 其他好文 > 详细

【POJ1005】I Think I Need a Houseboat

时间:2014-09-16 23:40:21      阅读:300      评论:0      收藏:0      [点我收藏+]

标签:style   blog   color   io   os   ar   div   sp   log   

说是计算几何,其实是一道水题。直接算半圆面积即可。

 

 1 #include <iostream>
 2 #include <cstdlib>
 3 #include <cstdio>
 4 #include <cstring>
 5 #include <cctype>
 6 #include <numeric>
 7 #include <cmath>
 8 #include <algorithm>
 9 
10 #define PI acos(-1)
11 
12 using namespace std;
13 int main () {
14     //cout << PI << endl;
15     ios :: sync_with_stdio(false);
16     int T; cin >> T;
17     int cnt = 0;
18     while (T --) {
19         double x, y;
20         cin >> x >> y;
21         double S = 0.5 * (x * x + y * y) * PI / 50.0;
22         //cout << S << endl;
23         int ans = ceil(S);
24         printf ("Property %d: This property will begin eroding in year %d.\n", ++ cnt, ans);
25         if (T == 0) {
26             printf ("END OF OUTPUT.\n");
27         }
28     }
29     return 0;
30 }

 

【POJ1005】I Think I Need a Houseboat

标签:style   blog   color   io   os   ar   div   sp   log   

原文地址:http://www.cnblogs.com/Destiny-Gem/p/3976058.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!