摘要:
C构造一个矩阵,然后采用矩阵快速幂#include #include #include #include #include using namespace std;typedef long long LL;const LL mod = 1000000007;const int maxn=1>=1; ... 阅读全文
摘要:
这题说的是给了一个模板串 然后又给了一个串 需要找出类似的按个模板串 , 改相等的位置要相等 该大于的位置到大于我们将模板串做好失配指针就ok了,然后匹配和原来的匹配不同,这个匹配需要的是相对匹配,只要他们的相对位置相同就ok了,每次计算要插入的数在这个匹配中的排位#include #include... 阅读全文
摘要:
#include #include #include #include #include using namespace std;typedef long long LL;struct Node{ int idx; LL val; Node(int cidx=0, LL cval=0){ ... 阅读全文
摘要:
D分4种情况讨论1 不需要加边 , 就是说原本就有一个奇数环,我们只要跑一次二分图就好了2 加一条边 , 也就是说存在大于等于3个点的联通块 我们对于这个联通块也跑一遍二分图, 可以知道图中所有的 同颜色染色中的点任意相连,都是一个奇数环,那么对于每个联通分量都有相应的数可以计算3 加两条边,也就是... 阅读全文
摘要:
这题计算 一张图上 能走的 点对有多少个 对于每个限制边权 , 对每条边排序,对每个查询排序然后边做克鲁斯卡尔算法的时候变计算就好了#include #include #include #include #include #include using namespace std;const int ... 阅读全文
摘要:
题意初始给了 1 2 两个数第二步 因为第2个数是2 所以 在序列后面放上2个2 包括他自己之前有的 序列变成 1 2 2第三步 因为第3个数是2 所以 在序列后面放上2个3 就变成了 1 2 2 3 3第4步 第4个数为3 所以 在序列后面放上3个4 变成 1 2 2 3 3 4 4 4以此... 阅读全文
摘要:
#include #include #include #include #include using namespace std;const int maxn=20005;int MaxRepresstation(char * S, int len ) { int i = 0, j = 1... 阅读全文
摘要:
#include #include #include #include #include using namespace std;const int maxn=2000005;int MinRepresstation(char * S, int len ) { int i = 0, j =... 阅读全文
摘要:
#include #include #include #include #include using namespace std;const int maxn=10005;struct elem{ char str[105]; int len; bool operator = le... 阅读全文
摘要:
题意 一个人打比赛 ,rating 有p的概率 为加50分 有1-p的概率为 x-100分 最大值为 1000 最小值为0有两个号 每次拿较小的号来提交 , 计算最后到达 1000分得期望场数是多少,对每个状态建立一个方程然后用高斯消元解决#include #include #include #in... 阅读全文