摘要: 题意很清楚,直接dp即可,dp[i][j]表示到第i个字符的状态为j的方案数,这里状态指的是子序列最大下标到第i直接dp即可,dp[i][j]表示到第i个字符的状态为j的方案数,这里状态指的是子序列最大下标到第i直接dp即可,dp[i][j]表示到第i个字符... 阅读全文
posted @ 2019-03-09 12:55 pubgoso 阅读(188) 评论(0) 推荐(0) 编辑
摘要: n∗lognn*lognn∗logn写法,lis[i]的意义为:所有最长上升子序列长度为i的位置上的最小a数组元素值lis[i]的意义为:所有最长上升子序列长度为i的位置上的最小a数组元素值lis[i]的意义为:所有最长上升子序列长度为i的位置上的最小a数组... 阅读全文
posted @ 2019-03-08 21:06 pubgoso 阅读(191) 评论(0) 推荐(0) 编辑
摘要: 看完题,大概就懂是求树的直径了,然后求树的直径,就自己选方法了。。。。。。(从网上抄的)#include#define LL long long#define fi first#define se second#define mp make_pair#def... 阅读全文
posted @ 2019-03-07 21:25 pubgoso 阅读(234) 评论(0) 推荐(0) 编辑
摘要: 读完题就知道是生成树的题,然后注意一下就是,找完一颗树之后,遍历剩下的边,小于0就在加上即可。先找没河的,再加上有河的再跑一遍克鲁斯卡尔就好了。#include#define LL long long#define fi first#define se se... 阅读全文
posted @ 2019-03-07 14:07 pubgoso 阅读(175) 评论(0) 推荐(0) 编辑
摘要: 题目链接大意:一段旅途长度N,中间可能存在N-1个休息站,连续走k长度时,疲劳值为a1+a2+...+aka_1+a_2+...+a_ka1​+a2​+...+ak​,休息后a1a_1a1​开始计,设PPP为疲劳值的期望,问p∗2n−1取模998244353... 阅读全文
posted @ 2019-03-03 11:35 pubgoso 阅读(102) 评论(0) 推荐(0) 编辑
摘要: #define PI acos(-1.0)#define ll long long intconst int maxn = 1e2 + 5;using namespace std;struct point { // 这里的点是指球 double x,y... 阅读全文
posted @ 2019-03-01 21:50 pubgoso 阅读(130) 评论(0) 推荐(0) 编辑
摘要: 题目链接题目大意:给你n个物品,第iii个物品价值aia_iai​,询问q次,问你能不能凑出价值为qiq_iqi​的物品。小贪心吧。从大到小找,能拿就拿就行了。 #include#define LL long long#define fi first#def... 阅读全文
posted @ 2019-03-01 15:40 pubgoso 阅读(263) 评论(0) 推荐(0) 编辑
摘要: 题目链接题意:给你一棵树,然后连接两个有公共邻居的点,问你连完后,任意两点的距离之和。一开始看这种题,还不怎么会做,借鉴了这位大佬的博客,get到了新技能,当我们求树上任意俩点的距离之时,可以转化问题,不看点,而看边,每条边的使用次数是固定的,每条边使用的次... 阅读全文
posted @ 2019-02-21 16:03 pubgoso 阅读(110) 评论(0) 推荐(0) 编辑
摘要: A链接讨论一下2a2a2a跟bbb的大小关系即可。#include #include #include #include #include #include #include #include #include #include #include #incl... 阅读全文
posted @ 2019-02-20 13:41 pubgoso 阅读(227) 评论(0) 推荐(0) 编辑
摘要: 题目链接题目要求的是得到k种不同的元素,(题解)将每种类型视为一个点,跑一边克鲁斯卡尔即可。#include #include #include #include #include #include #include #include #include #i... 阅读全文
posted @ 2019-01-29 20:18 pubgoso 阅读(130) 评论(0) 推荐(0) 编辑