Gym
QiHang_QiHang
这个作者很懒,什么都没留下…
展开
-
Gym - 101502B. Linear Algebra Test
Dr. Wail is preparing for today's test in linear algebra course. The test's subject isMatrices Multiplication.Dr. Wail has n matrices, such that the size of theith matrix is(ai × bi), wherea原创 2018-03-23 19:59:01 · 329 阅读 · 0 评论 -
Gym 101353H 树型DP
题意:求一棵树的所有简单路径权值之和,节点1为树的根第一行T组样例每个样例一个n(多少个节点)接下来n-1行每行u,v,w(两个节点,两节点的距离(权值))思路:设dp[u]为以u为根的子树的价值,sz[u]为以u为根的子树的节点数,val[u]为u与所有子节点的距离之和deep[u]为u的深度,设u为当前节点,v为u的子节点val[u]=∑(val[v]+原创 2018-04-10 09:56:34 · 223 阅读 · 0 评论 -
Gym - 101628A DP
题意:在a字符串中删除某个w子串(可以分散的),问能到多少种b字符串。样例: Input weewrshkimsim Output 1 Input qqqaaabbbcccfffrrrqabcfr Output 729思路:题目意思实则就是求a串中的w串有多少种组成种类。dp[i][j] 表示 a串前i个字符 构成w字符...原创 2018-05-16 21:13:18 · 225 阅读 · 0 评论