Codeforces Round #340 (Div. 2)B】的更多相关文章

[Codeforces Round #340 (Div. 2)] vp了一场cf..(打不了深夜的场啊!!) A.Elephant 水题,直接贪心,能用5步走5步. B.Chocolate 乘法原理计数,统计连续的“0”到下一个“1”的个数,然后相乘(第一个1前面的0不能算上).当然还要特判全0的情况. C.Watering Flowers 这题1A.只要按照以到某一个喷泉的距离排序,然后枚举没有被这一个喷泉覆盖到的个数,然后通过第二个喷泉覆盖,贪心一下就好了. D.Polyline 题意杀,还…
E. XOR and Favorite Number 题目连接: http://www.codeforces.com/contest/617/problem/E Descriptionww.co Bob has a favorite number k and ai of length n. Now he asks you to answer m queries. Each query is given by a pair li and ri and asks you to count the n…
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…
B. Chocolate 题目连接: http://www.codeforces.com/contest/617/problem/D Descriptionww.co Bob loves everything sweet. His favorite chocolate bar consists of pieces, each piece may contain a nut. Bob wants to break the bar of chocolate into multiple pieces…
A. Elephant 题目连接: http://www.codeforces.com/contest/617/problem/A Descriptionww.co An elephant decided to visit his friend. It turned out that the elephant's house is located at point 0 and his friend's house is located at point x(x > 0) of the coord…
D. Polyline 题目连接: http://www.codeforces.com/contest/617/problem/D Descriptionww.co There are three points marked on the coordinate plane. The goal is to make a simple polyline, without self-intersections and self-touches, such that it passes through…
题意与分析 (CodeForces 617C) 题意是这样的:一个花圃中有若干花和两个喷泉,你可以调节水的压力使得两个喷泉各自分别以\(r_1\)和\(r_2\)为最远距离向外喷水.你需要调整\(r_1,r_2\)的值使得所有的花都能被水所灌溉--换句话说,每一朵花要么到第一个喷泉的距离不超过\(r_1\),要么到第二个喷泉的距离不超过\(r_2\).当然如果两个条件都满足也是可以的.你需要用尽可能少的水来实现以上要求,也就是说使得\(r_1^2+r_2^2\)尽可能的小.找出这个最小值. 那么…
任意门:http://codeforces.com/problemset/problem/617/E E. XOR and Favorite Number time limit per test 4 seconds memory limit per test 256 megabytes input standard input output standard output Bob has a favorite number k and ai of length n. Now he asks yo…
题目链接:http://codeforces.com/problemset/problem/617/E E. XOR and Favorite Number time limit per test 4 seconds memory limit per test 256 megabytes input standard input output standard output Bob has a favorite number k and ai of length n. Now he asks y…
题目链接:http://codeforces.com/contest/617/problem/E 题目大意:有n个数和m次查询,每次查询区间[l, r]问满足ai ^ ai+1 ^ ... ^ aj == k的(i, j)  (l <= i <= j <= r)有多少对. 解题思路:先预处理出一个前缀异或和数组sum数组,则a[l]^a[l+1]^a[l+2]……^a[r]就等于sum[r]^sum[l-1] 然后我们采用莫队算法,用一个数组cnt数组记录前缀和出现的次数 我们要找之前有…