cf340 C. Watering Flowers】的更多相关文章

C. Watering Flowers time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output A flowerbed has many flowers and two fountains. You can adjust the water pressure and set any values r1(r1 ≥ 0) and r2(r…
C. Watering Flowers 题目连接: http://www.codeforces.com/contest/617/problem/C Descriptionww.co A flowerbed has many flowers and two fountains. You can adjust the water pressure and set any values r1(r1 ≥ 0) and r2(r2 ≥ 0), giving the distances at which t…
题目: http://www.codeforces.com/contest/617/problem/C 自己感觉是挺有新意的一个题目, 乍一看挺难得(= =). 其实比较容易想到的一个笨办法就是:分别计算出每个点到喷泉的距离,然后分别按照距离远近排序(要用到两个数组),然后选定一个喷泉,从近到远依次选点,然后标记该点,从另一个喷泉中找到距离他最远且还没用被标记的点,这个距离加前一个喷泉的距离就是要求的答案,选最小的即可,n方的时间复杂度. 需要注意的几点: 1.         对于每个点最好用…
无脑暴力题,算出所有点到圆心p1的距离的平方,从小到大排序. 然后暴力枚举p1的半径的平方,计算剩余点中到p2的最大距离的平方,枚举过程中记录答案 #include<cstdio> #include<cstring> #include<vector> #include<cmath> #include<queue> #include<list> #include<algorithm> using namespace std;…
题意与分析 (CodeForces 617C) 题意是这样的:一个花圃中有若干花和两个喷泉,你可以调节水的压力使得两个喷泉各自分别以\(r_1\)和\(r_2\)为最远距离向外喷水.你需要调整\(r_1,r_2\)的值使得所有的花都能被水所灌溉--换句话说,每一朵花要么到第一个喷泉的距离不超过\(r_1\),要么到第二个喷泉的距离不超过\(r_2\).当然如果两个条件都满足也是可以的.你需要用尽可能少的水来实现以上要求,也就是说使得\(r_1^2+r_2^2\)尽可能的小.找出这个最小值. 那么…
[Codeforces Round #340 (Div. 2)] vp了一场cf..(打不了深夜的场啊!!) A.Elephant 水题,直接贪心,能用5步走5步. B.Chocolate 乘法原理计数,统计连续的“0”到下一个“1”的个数,然后相乘(第一个1前面的0不能算上).当然还要特判全0的情况. C.Watering Flowers 这题1A.只要按照以到某一个喷泉的距离排序,然后枚举没有被这一个喷泉覆盖到的个数,然后通过第二个喷泉覆盖,贪心一下就好了. D.Polyline 题意杀,还…
Codeforces Round #258 (Div. 2) Devu and Flowers E. Devu and Flowers time limit per test 4 seconds memory limit per test 256 megabytes input standard input output standard output Devu wants to decorate his garden with flowers. He has purchased n boxes…
http://poj.org/problem?id=3262 Protecting the Flowers Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 4930   Accepted: 1965 Description Farmer John went to cut some wood and left N (2 ≤ N ≤ 100,000) cows eating the grass, as usual. When…
B. Alyona and flowers Problem Description: Let's define a subarray as a segment of consecutive flowers. The mother suggested some set of subarrays. Alyona wants to choose several of the subarrays suggested by her mother. After that, each of the flowe…
Description You want to arrange the window of your flower shop in a most pleasant way. You have F bunches of flowers, each being of a different kind, and at least as many vases ordered in a row. The vases are glued onto the shelf and are numbered con…