CodeForces 429B Working out 动态规划】的更多相关文章

Description Summer is coming! It's time for Iahub and Iahubina to work out, as they both want to look hot at the beach. The gym where they go is a matrix a with n lines and m columns. Let number a[i][j] represents the calories burned by performing wo…
E - Working out Time Limit:2000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u Submit Status Practice CodeForces 429B 描述 Summer is coming! It's time for Iahub and Iahubina to work out, as they both want to look hot at the beach. The gy…
http://codeforces.com/problemset/problem/429/B 可以参考这篇文章: http://blog.csdn.net/pure_lady/article/details/46764839 因为有断点,所以可以预处理四个顶点到任意点的距离最大值,通过拼接得到断点后的距离 然后就是枚举断点的情况,发现断点不可能在边缘,就可以开始写了 #include <iostream> #include <string> #include <cstring…
There are n cities and n - 1 roads in the Seven Kingdoms, each road connects two cities and we can reach any city from any other by the roads. Theon and Yara Greyjoy are on a horse in the first city, they are starting traveling through the roads. But…
Some time ago Slastyona the Sweetmaid decided to open her own bakery! She bought required ingredients and a wonder-oven which can bake several types of cakes, and opened the bakery. Soon the expenses started to overcome the income, so Slastyona decid…
Let's call the roundness of the number the number of zeros to which it ends. You have an array of n numbers. You need to choose a subset of exactly k numbers so that the roundness of the product of the selected numbers will be maximum possible. Input…
http://codeforces.com/contest/429/problem/B 题意:一个从左下到右上,一个从左上到右下,要求只相交一次,求整个路径和的最大值 思路:发现可以枚举交点,然后算到四个角的值,而且,边界上面的点不可能作为交点. #include<cstdio> #include<cmath> #include<algorithm> #include<cstring> #include<iostream> ][],f2[][],…
原文链接http://www.cnblogs.com/zhouzhendong/p/8848990.html 题目传送门 - CodeForces 623E 题意 给定$n,k$. 让你构造序列$a(0<a_i<2^k)$,满足$b_i(b_i=a_1\ or\ a_2\ or\ \cdots\ or\ a_i)$严格单调递增.($or$为按位或) 问你方案总数.对$10^9+7$取模. $n\leq 10^{18},k\leq 30000$ 题解 毛爷爷论文题. 我怀疑我看到的是假论文.里面…
题目传送门 传送门 题目大意 餐厅有$n$张桌子,第$i$张桌子可以容纳$c_i$个人,有$t$组客人,每组客人的人数等概率是$[1, g]$中的整数. 每来一组人数为$x$客人,餐厅如果能找到最小的$c_j$使得$c_j \geqslant x$,那么就会把这张桌子分配给这些客人,并得到$x$的收益. 问期望的收益. 好像可以枚举每一种人数,然后算一下,但时间复杂度很爆炸. 先添加若干个容量为$\infty$的桌子.这样每组人一定能够分配到一张桌子,只是可能没有收益. 考虑最后答案一定是将桌子…
原文链接https://www.cnblogs.com/zhouzhendong/p/CF264C.html 题目传送门 - CF264C 题意 给定一个有 $n$ 个元素的序列,序列的每一个元素是个球,第 $i$ 个球具有 $v_i$ 的值,颜色为 $c_i$ . 一个序列的价值为每一个球价值和. 在一个序列中,第 $i$ 个球的价值为: 当 $c_i=c_{i-1}(i>1)$ 时,$value=a\times v_i$. 否则, $value=b\times v_i$ . 接下来有 $q$…