和这一题构造的矩阵的方法相同。
需要注意的是,题目中a0~a9 与矩阵相乘的顺序。
#include
#include
#include
#include
#include
#define N 10
using namespace std;
int mod;
typedef long long LL;
struct matrix
{
LL a[10][10];
}...
分类:
其他好文 时间:
2014-06-16 12:06:07
阅读次数:
231
题目
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
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