摘要:
依次考虑一个数的倍数,两个数的倍数(lcm),三个数的倍数(lcm)。。。 会发现有这么一个规律,奇数个数时要加上情况数,偶数个数时要减去情况数。 一种只有10个数,用二进制枚举所有情况即可。 #include <cstdio> #include <algorithm> #include <cstr 阅读全文
posted @ 2016-02-17 23:23
Helica
阅读(267)
评论(0)
推荐(0)
摘要:
有n个家庭,m个房间,一个房间只能两个家庭住。求最大匹配。 比较标准的二分图问题。先初始化把可能的家庭建边,然后跑一边匈牙利算法。 最后的答案是最大匹配数/2,因为建图时有重复。 #include <cstdio> #include <algorithm> #include <cstring> #i 阅读全文
posted @ 2016-02-17 23:19
Helica
阅读(277)
评论(0)
推荐(0)
摘要:
有两段字符串,第一段的尾和第二段的头可能重合。问有多少种组合的可能。 需要理解一下next数组的意义。 #include <cstdio> #include <cstring> #include <algorithm> using namespace std; const int maxn = 10 阅读全文
posted @ 2016-02-17 23:15
Helica
阅读(175)
评论(0)
推荐(0)
摘要:
很水的模拟题,拿数组搞就好了。 注意边界的地方不要算重。 #include <cstdio> #include <cstring> #include <algorithm> using namespace std; int N,T,M; int save[10000]; char str[1000] 阅读全文
posted @ 2016-02-17 23:04
Helica
阅读(193)
评论(0)
推荐(0)

浙公网安备 33010602011771号