比赛 |
20120717 |
评测结果 |
AAAATTTTTT |
题目名称 |
信使问题b |
最终得分 |
40 |
用户昵称 |
王者自由 |
运行时间 |
3.388 s |
代码语言 |
C++ |
内存使用 |
3.60 MiB |
提交时间 |
2012-07-17 08:43:19 |
显示代码纯文本
- #include <cstdio>
- #include <cstdlib>
- #include <cmath>
- #include <algorithm>
- using namespace std;
- const int N = 100000 + 10;
- int n, x[N], y[N], a, b, c;
- inline int calc(int u, int v) {
- return u*u + v*v;
- }
- int main() {
- freopen("postmanb.in", "r", stdin);
- freopen("postmanb.out", "w", stdout);
- scanf("%d", &n);
- for(int i=0; i<n; i++)
- scanf("%d %d", x+i, y+i);
- a = 0, b = calc(x[0]-x[1], y[0]-y[1]);
- for(int i=0; i<n-1; i++)
- for(int j=i+1; j<n; j++) {
- c = calc(x[i]-x[j], y[i]-y[j]);
- if(c > a)
- a = c;
- else if(c < b)
- b = c;
- }
- printf("%lf\n%lf\n", sqrt(a*1.0), sqrt(b*1.0));
- return 0;
- }