首页 > 其他 > 详细

第二周 1.24-1.30

时间:2016-01-24 12:57:33      阅读:139      评论:0      收藏:0      [点我收藏+]

1.24

CF 617 C Watering Flowers

sbsbsbsbsbsb

技术分享
 1 #include <iostream>
 2 #include <cstdio>
 3 #include <algorithm>
 4 using namespace std;
 5 typedef long long LL;
 6 LL x[2222], y[2222], d1[2222], d2[2222];
 7 int n;
 8 
 9 LL cal(LL x)
10 {
11     LL ret = 0LL;
12     for(int i = 0; i < n; i++)
13     {
14         if(d1[i] <= x) continue;
15         ret = max(ret, d2[i]);
16     }
17     return ret;
18 }
19 
20 int main(void)
21 {
22     LL x1, y1, x2, y2;
23     scanf("%d %I64d %I64d %I64d %I64d", &n, &x1, &y1, &x2, &y2);
24     for(int i = 0; i < n; i++) scanf("%I64d %I64d", x + i, y + i);
25     for(int i = 0; i < n; i++)
26     {
27         LL xx = x1 - x[i], yy = y1 - y[i];
28         d1[i] = xx * xx + yy * yy;
29         xx = x2 - x[i], yy = y2 - y[i];
30         d2[i] = xx * xx + yy * yy;
31     }
32     LL ans = cal(0);
33     for(int i = 0; i < n; i++)
34         ans = min(ans, d1[i] + cal(d1[i]));
35     printf("%I64d\n", ans);
36     return 0;
37 }
Aguin

 

第二周 1.24-1.30

原文:http://www.cnblogs.com/Aguin/p/5154866.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!