![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
思路题
文章平均质量分 56
Kim0403
这个作者很懒,什么都没留下…
展开
-
CodeForces 289B Polo the Penguin and Matrix
觉得和矩阵没什么关系,直接看成一个数列,从中位数开始,小的增加d,大的减小d,求操作多少次即可。 如果取余不相等,那肯定不可能转换成同一个数字。 #include #include #include #include #include #include #include #include #include #include #include #include #include #include原创 2016-07-25 20:54:13 · 1079 阅读 · 0 评论 -
CodeForces 534B Covered Path
前半段肯定是加速,后半段可能要减速。有个有意思的解法 #include #include #include #include #include #include #include #include #include #include using namespace std; int main() { int i,v1,v2,t,d,sum; while (~s原创 2016-07-25 22:02:53 · 313 阅读 · 0 评论 -
CodeForces 349B Color the Fence
先算出最多能有多少个数字,即最大能是多少位,然后再使这个数尽可能大,即最高位越大越好 如 7 5 4 3 2 2 2 3 4 5 输出:766 #include #include #include #include #include #include #include #include #include #include #include #include #include #inclu原创 2016-07-19 16:08:59 · 353 阅读 · 0 评论 -
HDU 4455 Substrings dp
给定一个序列,个数为n。再给出一系列w;对于每个w,求序列中,所有长度为w的连续子串中的权值和,子串权值为子串中不同数字的个数。 dp[i]表示w=i时所求的答案。dp[1]=n,这个很容易知道,dp[2]中的子串就是删去dp[1]中最后一个子串,再每个子串加上其之后的那个数,以此类推。 对于dp[i-1]推dp[i],加上的那部分:只有当这个数与它前面同值数最短距离大于等于i时才会加权值,否原创 2016-08-08 19:58:50 · 541 阅读 · 0 评论 -
POJ 3671 Dining Cows
可能大家多用的是dp,这里说种其他方法 2111221把这种序列用最少次数变成1111222这种 思路 1.按顺序统计当前1的个数和2的个数。 2.计算从当前位置改,前面会有多少个2被改,当前位置后面有多少个1也会被改。for一遍求最小。 3.得到的答案与1的总数和2的总数进行一次比较!!有卡这一条的数据 number:2 1 1 1 2 2 1 sum2 :1原创 2016-08-10 11:34:26 · 323 阅读 · 0 评论 -
HDU 6139 Galaxy at War 2017 MUTC
这题在多校现场,才22队出。虽然最后结果是25个队,但是有三个队是随机数过的,是的,全凭运气。 为什么我知道呢,因为第一个用随机数A掉的就是我…… 官方题解: 这是本场比赛最大的坑题. 首先, 棋盘就是一个二分图, 可以得出任意一个Meditation (u, v)(u,v)和任意一个pollutant (a, b)(a,b), u+vu+v和u-vu−v就原创 2017-08-18 19:42:03 · 571 阅读 · 2 评论 -
UvaLive 6600 Spanning trees in a secure lock pattern 矩阵行列式
这是去年尝试过得题目。今年还是不会。只能先搬大佬题解过来。来自:http://blog.csdn.net/ooooooooe/article/details/38899517 题意:给一个N*N个点的矩阵(N 思路:题里给的很明白,就是列一个每个点的边的矩阵,然后求子矩阵的行列式就可以了,因为N只有6,所以打表就可以了。 打表代码: #include #inc转载 2017-08-21 21:02:28 · 265 阅读 · 0 评论