摘要:
Every morning when they are milked, the Farmer John's cows form a rectangular grid that is R (1 <= R <= 10,000) rows by C (1 <= C <= 75) columns. As w 阅读全文
摘要:
Maximum repetition substring The repetition number of a string is defined as the maximum number R such that the string can be partitioned into R same 阅读全文
摘要:
附上一个详细的大佬的讲解 http://blog.csdn.net/niushuai666/article/details/6624672 RMQ模板(NYOJ 119) 阅读全文
摘要:
感谢 kuangbin大神 http://www.cnblogs.com/kuangbin/archive/2012/08/14/2638803.html 转一下模板 方便自己查阅 该算法时间复杂度是O(m+n), 得到Next数组的过程是O(n) /*pku3461(Oulipo), hdu171 阅读全文
摘要:
#include #include #include using namespace std; int a[50]; int dp[50][50]; int dfs(int num, ,bool limit) //位数,传递条件 ,上界判断 { if(num==-1)return 0; //最后一位时,根据情况返回1或0 if(!limit && dp[num... 阅读全文
摘要:
Given two strings a and b we define a*b to be their concatenation. For example, if a = "abc" and b = "def" then a*b = "abcdef". If we think of concate 阅读全文
摘要:
Musical Theme A musical melody is represented as a sequence of N (1<=N<=20000)notes that are integers in the range 1..88, each representing a key on t 阅读全文
摘要:
组合数取模就是求C(n,m)%MOD的值 当m<=1000,n<=1000时,根据 C[i][j]=(C[i-1][j]+C[i-1][j-1])的性质,可以通过递推预处理出所有的组合数 利用阶乘进行的线性求组合数 对于大范围的组合数 引用自http://blog.csdn.net/acdreame 阅读全文
摘要:
单点更新(HDU1166) 区间更新(HDU1698) 阅读全文
摘要:
//查询和修改都是log(n)//从c[1]开始进行赋值,不赋c[0],n为数的个数 //sum(x)为计算前x个数的和 #include #include #include using namespace std; const int MAXN=50010; int c[MAXN]; int n; int lowbit(int x) { return x&(-x); } vo... 阅读全文