URAL 1640. Circle of Winter
2011-09-13 15:19
246 查看
这题目太可爱了。我喜欢。。不过还是有点坑。。
看了样例,以为是最小圆覆盖,直接套模板了,悲剧WA掉,discuss也没啥帮助信息。。。重新读题,发现输出坑姐了。
有demon的地方不能是圆的中心,求的不是最小圆,能把所有点都覆盖掉而且至少有一个点在圆周上即可,这个这个。。。我在想,怎么找一个点和其他点都不重合呢。。。
看了下坐标范围。。。太仁慈了!!半径小于1W,点的坐标绝对值都小于1000.。。。我直接设圆心为(1010,1010)。。。找最远的点的距离为半径。。。然后就过了。。。
这题太可爱了。
看了样例,以为是最小圆覆盖,直接套模板了,悲剧WA掉,discuss也没啥帮助信息。。。重新读题,发现输出坑姐了。
有demon的地方不能是圆的中心,求的不是最小圆,能把所有点都覆盖掉而且至少有一个点在圆周上即可,这个这个。。。我在想,怎么找一个点和其他点都不重合呢。。。
看了下坐标范围。。。太仁慈了!!半径小于1W,点的坐标绝对值都小于1000.。。。我直接设圆心为(1010,1010)。。。找最远的点的距离为半径。。。然后就过了。。。
这题太可爱了。
#include <set> #include <map> #include <queue> #include <stack> #include <math.h> #include <stdio.h> #include <stdlib.h> #include <iostream> #include <limits.h> #include <string.h> #include <string> #include <algorithm> #define MID(x,y) ( ( x + y ) >> 1 ) #define L(x) ( x << 1 ) #define R(x) ( x << 1 | 1 ) #define FOR(i,s,t) for(int i=(s); i<(t); i++) #define BUG puts("here!!!") #define STOP system("pause") #define file_r(x) freopen(x, "r", stdin) #define file_w(x) freopen(x, "w", stdout) using namespace std; const int MAX = 110; struct point { double x,y; void get() { scanf("%lf%lf", &x, &y); } }; point p[MAX]; const double eps = 1e-9; bool dy(double x,double y) { return x > y + eps;} // x > y bool xy(double x,double y) { return x < y - eps;} // x < y bool dyd(double x,double y) { return x > y - eps;} // x >= y bool xyd(double x,double y) { return x < y + eps;} // x <= y bool dd(double x,double y) { return fabs( x - y ) < eps;} // x == y double disp2p(point a,point b) // a b 两点之间的距离 { return sqrt( ( a.x - b.x ) * ( a.x - b.x ) + ( a.y - b.y ) * ( a.y - b.y ) ); } int main() { int n; double r; point c; c.x = c.y = 1010; while( ~scanf("%d", &n) ) { FOR(i, 0, n) p[i].get(); double r = 0; FOR(i, 0, n) if( dy(disp2p(c, p[i]), r) ) r = disp2p(c, p[i]); printf("%.15lf %.15lf %.15lf\n", c.x, c.y, r); } return 0; }
相关文章推荐
- ural 1640 Circle of Winter
- URAL 1640 Circle of Winter
- URAL 1640 — Circle of Winter
- acm - 1640. Circle of Winter 最为简单的形式- 构造解 非最优解
- 约瑟夫问题 URAL 1098
- URAL 1329. Galactic History
- URAL Goat in the Garden(圆与矩形求交集面积)
- URAL 1333 Genie Bomber 2(正方形被圆覆盖的面积)
- Ural 1009 K-based Numbers(DP)
- ural 1225.Flags(简单dp)
- URAL1917_Titan Ruins: Better late than killed_二分搜索
- URAL 1133 Fibonacci Sequence(数论)
- ural 1057 Amount of degrees 【数位dp】
- URAL 1748. The Most Complex Number(反素数)
- URAL 1348. Goat in the Garden 2[求点到线段的距离]
- URAL 1287. Mars Canals 滚动数组+DP
- 【URAL】1297 Palindrome 【后缀数组+RMQ——求最长回文子串】
- 【Ural】1519. Formula 1
- 2014 Winter Vacation Practice No.3 Translation
- 【神题】URAL 1575 Yekaterinburg Subway 2