码迷,mamicode.com
首页 >  
搜索关键字:hdoj matrix    ( 6780个结果
Leetcode: Rotate Image
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?抠细节的题,题目思想如下:to...
分类:其他好文   时间:2014-06-28 22:11:37    阅读次数:214
矩阵快速幂模板
矩阵快速幂其实跟普通快速幂一样,只是把数换成矩阵而已。模板,两种写法,亲测可用://made by whatbeg//2014.6.15struct Matrix{ int m[3][3];};Matrix Mul(Matrix a,Matrix b){ Matrix c; mem...
分类:其他好文   时间:2014-06-18 22:35:45    阅读次数:277
leetcode--Spiral Matrix II
Given an integern, generate a square matrix filled with elements from 1 ton2in spiral order.For example,Givenn=3,You should return the following matri...
分类:其他好文   时间:2014-06-18 21:56:47    阅读次数:209
leetcode--Spiral Matrix
Given a matrix ofmxnelements (mrows,ncolumns), return all elements of the matrix in spiral order.For example,Given the following matrix:[ [ 1, 2, 3 ],...
分类:其他好文   时间:2014-06-18 21:56:06    阅读次数:215
leetcode--Rotate Image
You are given annxn2D matrix representing an image.Rotate the image by 90 degrees (clockwise).Follow up:Could you do this in-place?public class Soluti...
分类:其他好文   时间:2014-06-18 21:54:54    阅读次数:232
Big Number------HDOJ杭电1212(大数运算)
Problem DescriptionAs we know, Big Number is always troublesome. But it's really important in our ACM. And today, your task is to write a program to c...
分类:其他好文   时间:2014-06-18 21:09:31    阅读次数:303
【Leetcode】Set Matrix Zeroes
Given a m x n matrix, if an element is 0, set its entire row and column to 0. Do it in place. Could you devise a constant space solution? 思路:因为需要遍历整个矩阵,时间复杂度肯定需要O(m * n),对于空间复杂度而言,第一种是可以使用O(m * n),...
分类:其他好文   时间:2014-06-18 12:33:39    阅读次数:167
2875: [Noi2012]随机数生成器 - BZOJ
DescriptionInput包含6个用空格分割的m,a,c,X0,n和g,其中a,c,X0是非负整数,m,n,g是正整数。Output输出一个数,即Xn mod gSample Input11 8 7 1 5 3Sample Output2快速幂+快速乘 1 type 2 matrix=...
分类:其他好文   时间:2014-06-18 09:32:46    阅读次数:179
【HDOJ】1099 Lottery
题意超难懂,实则一道概率论的题目。求P(n)。P(n) = n*(1+1/2+1/3+1/4+...+1/n)。结果如果可以除尽则表示为整数,否则表示为假分数。 1 #include 2 #include 3 4 #define MAXN 25 5 6 __int64 buf[MAXN]; ...
分类:其他好文   时间:2014-06-17 23:44:34    阅读次数:335
高斯消元模版
矩阵的秩 typedef int Matrix[maxn][maxn]; int rank(Matrix A, int m, int n) { int i = 0, j = 0, k, r, u; while(i < m && j < n) { r = i; for(k = i; k < m; k++) if(A[k][j]) { r = k; brea...
分类:其他好文   时间:2014-06-17 19:03:00    阅读次数:210
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!