模板
M_Y_Y_
这个作者很懒,什么都没留下…
展开
-
母函数模板
有面值为1~5的20种硬币,每种都有无数个,问:一个价钱为m的物品,有多少种不同的付款方式。 int a[11111]; //记录指数为i的项的系数 int b[11111]; //中间数组 for(int i=0;i<=m;i++) //第一层括号 { a[i]=1; ...原创 2018-07-27 16:55:13 · 329 阅读 · 0 评论 -
错排公式
n个元素全部排在错误的位置,总共有 D(n) = (n-1) * ( D(n-1) + D(n-2) ) (递推公式) 种不同的方法。 由递推公式可以得出错排公式 D(n)=n!*(1/2!-1/3!+1/4!- 1/5!+ ··· ··· +((-1)^(n-1))/(n-1)!+((-1)^n)/n! ) ...原创 2018-07-18 15:30:52 · 222 阅读 · 0 评论 -
线段树模板
#include <algorithm> #include <iostream> #include <cstring> #include <cstdlib> #include <cstdio> #include <vector> #include <string> #include <cmath&a原创 2018-08-01 10:19:39 · 195 阅读 · 0 评论 -
高斯消元模板
#include<stdio.h> #include<algorithm> #include<iostream> #include<string.h> #include<math.h> using namespace std; const int MAXN=50; int a[MAXN][MAXN];//增广矩阵 int...转载 2018-08-09 21:07:54 · 116 阅读 · 0 评论 -
链式前向星(模板)
#include <algorithm> #include <iostream> #include <cstring> #include <cstdlib> #include <cstdio> #include <vector> #include <string> #include <cmath&a原创 2018-08-09 18:57:32 · 317 阅读 · 0 评论 -
不要62 (数位dp)
杭州人称那些傻乎乎粘嗒嗒的人为62(音:laoer)。 杭州交通管理局经常会扩充一些的士车牌照,新近出来一个好消息,以后上牌照,不再含有不吉利的数字了,这样一来,就可以消除个别的士司机和乘客的心理障碍,更安全地服务大众。 不吉利的数字为所有含有4或62的号码。例如: 62315 73418 88914 都属于不吉利号码。但是,61152虽然含有6和2,但不是62连号,所以不属于不吉利数字之列。 你...原创 2018-08-07 20:28:11 · 186 阅读 · 0 评论 -
Shortest Prefixes(字典树)
Description A prefix of a string is a substring starting at the beginning of the given string. The prefixes of “carbon” are: “c”, “ca”, “car”, “carb”, “carbo”, and “carbon”. Note that the empty string...原创 2018-11-15 21:00:19 · 1091 阅读 · 0 评论