随笔分类 -  倍增

摘要:vjudge题目传送门 luogu题目传送门 题解 首先,我们考虑如何统计所有边权都是1的经过x条边的路径总数。很简单,构造转移矩阵我们只需要相邻的两个点u->v,(u,v)++,再设一个计数器代表路径总数,(u,计数器)++,最后再 (计数器,计数器)=1。初始矩阵... 阅读全文
posted @ 2018-07-04 17:23 一剑霜寒十四洲 阅读(147) 评论(0) 推荐(0)
摘要:Battle over CitiesDescriptionIt is vitally important to have all the cities connected by highways in a war, but some of them are destr... 阅读全文
posted @ 2017-12-04 22:16 一剑霜寒十四洲 阅读(142) 评论(0) 推荐(0)
摘要:这里是我倍增的练习记录,大多都是水题……也有一些混合了其它算法的。= = silly……顺序可能有些错乱,并不是按照难度来排的。 T1 hdu3710 倍增+树剖 #include#include#include#includeusing namespace std;... 阅读全文
posted @ 2017-12-02 08:19 一剑霜寒十四洲 阅读(173) 评论(0) 推荐(0)