由于需要就地保存清零信息,所以把信息保存在第一行和第一列 1 class Solution { 2 public: 3 void setZeroes(vector > &matrix) { 4 const int ROW = matrix.size(); 5 ...
分类:
其他好文 时间:
2014-09-06 23:46:04
阅读次数:
261
Search a 2D Matrix
Total Accepted: 18506 Total
Submissions: 59402My Submissions
Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following pr...
分类:
其他好文 时间:
2014-09-05 18:21:38
阅读次数:
232
题目链接
题意:n*k的矩阵A和一个k*n的矩阵B,C = A * B。求M = (C)^(n * n)时,矩阵M中每个元素的和(每个元素都要MOD6)
思路:因为n最大到1000,所以不能直接用矩阵快速幂求AB的n*n次幂,但是可以将公式稍微转换下,M = AB * AB...* AB = A * (BA) *... * (BA) * B,这样BA的n*n -1次幂就能用...
分类:
其他好文 时间:
2014-09-05 16:17:22
阅读次数:
173
Write an efficient algorithm that searches for a value in anmxnmatrix. This matrix has the following properties:Integers in each row are sorted from l...
分类:
其他好文 时间:
2014-09-05 12:37:51
阅读次数:
215
Given amxnmatrix, if an element is 0, set its entire row and column to 0. Do it in place.click to show follow up.Follow up:Did you use extra space?A s...
分类:
其他好文 时间:
2014-09-05 07:39:10
阅读次数:
261
Description
Consider a tropical forrest, represented as a matrix. The cell from the right top corner of the matrix has the coordinates (1,1), and the coordinates of the other cells are determinated...
分类:
其他好文 时间:
2014-09-05 01:01:10
阅读次数:
282
总目录:http://blog.csdn.net/iloveas2014/article/details/38304477
4.2 图形变换矩阵——Matrix
先从Matrix这个最常用而且最简单的矩阵入手。
4.2.1 矩阵数学实现点的基本变换
Matrix用于实现二维平面图形的基本变换:移动,缩放,旋转和斜切。
一个平面由无数...
分类:
其他好文 时间:
2014-09-04 19:13:10
阅读次数:
158
总目录:http://blog.csdn.net/iloveas2014/article/details/38304477
4.2.2 矩阵变换的归纳及其在Matrix中的体现
虽然运算和矩阵的种类繁多,但稍稍整理一下,便不难得出,这些变换不外乎两类:与1*2矩阵相加和与2*2矩阵相乘:
和
所以,Matrix共包含6个变量,a,b...
分类:
其他好文 时间:
2014-09-04 19:11:40
阅读次数:
175
总目录:http://blog.csdn.net/iloveas2014/article/details/38304477
4.2.3 使用Matrix类实现图形变换
我们在ActionScript里new一个Matrix,它将是一个单位矩阵,a和d=1,其余4个属性都为0:
如果将这样的matrix应用到显示对象上,显示对象将不发生任...
分类:
其他好文 时间:
2014-09-04 19:09:10
阅读次数:
230
UVA 11082 - Matrix Decompressing
题目链接
题意:给定一个矩阵每行每列的和,要求现在构造一个矩阵满足元素在1-20之间,行列和满足条件
思路:行列建图,源点连到每个行,容量为和,每列连到汇点,容量为和,每行连到每列,容量20,注意这题要求的是1-20,所以可以先把所有位置-1,最后输出的时候+1即可
代码:
#include
#inc...
分类:
其他好文 时间:
2014-09-04 17:00:49
阅读次数:
229