摘要: 唐纳德是一个数学天才。有一天,他的数学老师决定为难一下他。他跟唐纳德说:「现在我们来玩一个游戏。这个游戏总共 n轮,每一轮我都会给你一个数(第 i 轮给出的数是 ai)。你每次要回答一个数,是我给出的这个数的质因数,并且你说出的数不能重复。」 因为数学老师是刻意为难,所以这个游戏很有可能不可能进行到 阅读全文
posted @ 2019-01-15 13:15 快乐的黄鳝 阅读(248) 评论(0) 推荐(0)
摘要: #include using namespace std; typedef struct w_W{ int eend; int weight; int next; }miao; miao x[100010]; int head[100010]; int cnt=0; void add(int s,int e,int w){ x[cnt].eend=e; ... 阅读全文
posted @ 2019-01-15 10:43 快乐的黄鳝 阅读(108) 评论(0) 推荐(0)
摘要: 题目链接 : https://codeforces.com/problemset/problem/961/E One day Polycarp decided to rewatch his absolute favourite episode of well-known TV series "Tuf 阅读全文
posted @ 2019-01-14 17:11 快乐的黄鳝 阅读(157) 评论(0) 推荐(0)
摘要: 转自博客 : https://www.cnblogs.com/fuyun-boy/p/5913438.html 转自博客:https://www.cnblogs.com/acgoto/p/8583952.html 阅读全文
posted @ 2019-01-14 09:37 快乐的黄鳝 阅读(111) 评论(0) 推荐(0)
摘要: 题目连接 : http://codeforces.com/problemset/problem/891/A You have an array a with length n, you can perform operations. Each operation is like this: choo 阅读全文
posted @ 2019-01-13 18:52 快乐的黄鳝 阅读(225) 评论(0) 推荐(0)
摘要: 本文转自大牛博客:http://www.byvoid.com/blog/hungary/ 这是一种用增广路求二分图最大匹配的算法。它由匈牙利数学家Edmonds于1965年提出,因而得名。 定义 未盖点:设Vi是图G的一个顶点,如果Vi 不与任意一条属于匹配M的边相关联,就称Vi 是一个未盖点。 交 阅读全文
posted @ 2018-10-16 21:12 快乐的黄鳝 阅读(198) 评论(0) 推荐(0)
摘要: 题目链接:https://codeforces.com/problemset/problem/282/C The Bitlandians are quite weird people. They do everything differently. They have a different alp 阅读全文
posted @ 2018-10-16 14:17 快乐的黄鳝 阅读(246) 评论(0) 推荐(0)
摘要: 匈牙利算法是由匈牙利数学家Edmonds于1965年提出,因而得名。匈牙利算法是基于Hall定理中充分性证明的思想,它是部图匹配最常见的算法,该算法的核心就是寻找增广路径,它是一种用增广路径求二分图最大匹配的算法。 等等,看得头大?那么请看下面的版本: 通过数代人的努力,你终于赶上了剩男剩女的大潮, 阅读全文
posted @ 2018-10-09 22:03 快乐的黄鳝 阅读(151) 评论(0) 推荐(0)
摘要: #include #include #include #include #include #include #include #include using namespace std; char x[10000]; char y[1000000]; int Next[10000]; void build_Next(){ int lenx=strlen(x); int j=0,k=... 阅读全文
posted @ 2018-10-04 16:31 快乐的黄鳝 阅读(101) 评论(0) 推荐(0)
摘要: 一个字符串的hash值: •现在我们希望找到一个hash函数,使得每一个字符串都能够映射到一个整数上 •比如hash[i]=(hash[i-1]*p+idx(s[i]))%mod •字符串:abc,bbc,aba,aadaabac •字符串下标从0开始 •先把a映射为1,b映射为2,c->3,d-> 阅读全文
posted @ 2018-10-04 16:21 快乐的黄鳝 阅读(147) 评论(0) 推荐(0)