H - K-Nice Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%lld & %llu Submit Status Practice ZOJ 3212 Description This is a super simple problem. The description is simple, the solution is simple. If you believe so, just read it on. O…
K - Watermelon Full of Water Time Limit:3000MS     Memory Limit:65536KB     64bit IO Format:%lld & %llu Submit Status Practice ZOJ 3632 Appoint description:   Description Watermelon is very popular in the hot summer. Students in ZJU-ICPC Team also lo…
K-Nice Time Limit: 1 Second      Memory Limit: 32768 KB      Special Judge This is a super simple problem. The description is simple, the solution is simple. If you believe so, just read it on. Or if you don't, just pretend that you can't see this on…
K-Nice Time Limit: 1 Second      Memory Limit: 32768 KB      Special Judge This is a super simple problem. The description is simple, the solution is simple. If you believe so, just read it on. Or if you don't, just pretend that you can't see this on…
下面的文字辅助理解来自http://blog.csdn.net/tbl_123/article/details/24884861 博弈论中的 K倍动态减法游戏,难度较大,参看了好多资料才懵懂! 此题可以看作 Fibonacci 博弈的扩展,建议没弄懂 Fibonacci博弈的先学那个,个人整理 http://blog.csdn.net/tbl_123/article/details/24033245 : 而说扩展体现在数列不再是Fib数列,是根据 k 的值自行构造的,其它换汤不换药,具体构造方法…
http://poj.org/problem?id=3613 s->t上经过k条边的最短路 先把1000范围的点离散化到200中,然后使用最短路可以使用floyd,由于求的是经过k条路的最短路,跑k-1次"floyd"即可(使用矩阵快速幂的思想). 把给定的图转为邻接矩阵,即A(i,j)=1当且仅当存在一条边i->j.令C=A*A,那么C(i,j)=ΣA(i,k)*A(k,j),实际上就等于从点i到点j恰好经过2条边的路径数(枚举k为中转点).类似地,C*A的第i行第j列就…
题解 这题是一道非常好的插头题,与一般的按格转移的题目不同,由于m很大,要矩阵乘法,这题需要你做一个按列转移的插头DP. 按列转移多少与按格转移不同,但大体上还是基于连通性进行转移.每一列只有右插头是对下一列的转移有影响的,那么我们只需要记录每一列的右插头的连通情况,用最小表示法表示为当前列的状态.在转移的时候,我们只知道上一列的右插头,即本列的左插头的情况,而上插头还需要自己记一个标记. 那么我们具体分析: 1.不存在上插头 1.同时存在左插头和右插头,不需要修改当前插头,直接把上一列的右插头…
Return an array of ones with the same shape and type as a given array. Parameters: a : array_like The shape and data-type of a define these same attributes of the returned array. dtype : data-type, optional Overrides the data type of the result. New…
题意:已知n个矩阵(下标从1开始),求下标x~y区间矩阵的乘积.最多m次询问,n ( 1 <= n <= 30,000) and m ( 1 <= m <= 30,000). 分析: 1.矩阵初始化为单位矩阵,因为要做乘积,E*A=A. 2.因为输出矩阵的所有值范围在0~r-1,所以要对r取余. #pragma comment(linker, "/STACK:102400000, 102400000") #include<cstdio> #inclu…
k近邻法是一种基本分类与回归方法.本章只讨论k近邻分类,回归方法将在随后专题中进行. 它可以进行多类分类,分类时根据在样本集合中其k个最近邻点的类别,通过多数表决等方式进行预测,因此不具有显式的学习过程.其本质是利用训练数据集对特征向量空间进行划分,并作为其分类的模型.k值选择.距离度量以及分类决策规则是其三个基本要素. 一.模型: 特征空间中,对每个训练点,距离该点比其他点更近的所有点组成一个区域(单元),每个训练点拥有一个区域(单元),所有训练点的区域(单元)构成对特征空间的一个划分.最近邻…