题目
You are given an n x n 2D matrix representing an image.
Rotate the image by 90 degrees (clockwise).
Follow up:
Could you do this in-place?
方法
矩阵坐标的转换,循环替换。
public voi...
分类:
其他好文 时间:
2014-06-16 11:28:03
阅读次数:
199
要完成的任务是,加载一个保存在txt文件中的矩阵, 并把它扩大10倍,并且要再次保存回去 %加载txt文件 >load(‘Matrix.txt’); %扩大10倍 repmat(Matrix,row column) % 这里的matrix 参数是要对其进行修改的matrix, 其中row是要新建的一...
分类:
其他好文 时间:
2014-06-15 22:02:20
阅读次数:
756
http://poj.org/problem?id=3233
ps转:
用二分方法求等比数列前n项和:即
原理:
(1)若n==0
(2)若n%2==0
(3)若n%2==1
代码如下:
LL sum(LL p,LL n)
{
if(n==0) return 1;
i...
分类:
其他好文 时间:
2014-06-15 20:01:44
阅读次数:
210
//职责链模式:使多个对象都有机会处理请求,从而避免请求的发送者和接受者之间的耦合关系。将这些对象连成一条链,并沿着这条链传递该请求,直到有一个对象处理它为止.//实例:申请费用的功能,不同金额的费用须要由不同的上级部分审核通过,假设下级没有审核的权限那么就让上级来进行审核//上代码//定义职责对象...
分类:
其他好文 时间:
2014-06-15 15:48:11
阅读次数:
121
Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties:
Integers in each row are sorted from left to right.The first integer of each...
分类:
其他好文 时间:
2014-06-15 14:12:44
阅读次数:
238
You are given an n x n 2D matrix representing an image.
Rotate the image by 90 degrees (clockwise).
Follow up:
Could you do this in-place?
思路:第一种思路是一层一层的进行旋转,比较直观,但是花费的时间要久一些;第二种思路则比较取巧,首先沿着...
分类:
其他好文 时间:
2014-06-15 08:46:26
阅读次数:
170
Spiral Matrix:Given a matrix ofmxnelements (mrows,ncolumns), return all elements of the matrix in spiral order.For example,Given the following matrix:...
分类:
其他好文 时间:
2014-06-14 21:42:10
阅读次数:
309
题目描述:输入一个矩阵,按照从外向里以顺时针的顺序依次打印出每一个数字class Solution {public: vector spiralOrder(vector > &matrix) { vector result; int nRows = matrix.s...
分类:
其他好文 时间:
2014-06-14 21:27:53
阅读次数:
156
android中矩阵的使用介绍,以及matrix中的主要函数的介绍...
分类:
移动开发 时间:
2014-06-14 14:16:33
阅读次数:
255
复杂度为o(n^3logk)
/*
求 a^k % mod,其中a是n*n的矩阵
*/
const int mod = 10000;
const int maxn = 2;
_LL k;
int n;
struct matrix
{
_LL mat[maxn][maxn];
} a,res;
matrix mul(matrix x, matrix y)
{
matrix tmp...
分类:
其他好文 时间:
2014-06-14 07:46:19
阅读次数:
206