码迷,mamicode.com
首页 >  
搜索关键字:hdoj matrix    ( 6780个结果
hdu 1757 A Simple Math Problem (矩阵快速幂)
和这一题构造的矩阵的方法相同。 需要注意的是,题目中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
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? 方法 矩阵坐标的转换,循环替换。 public voi...
分类:其他好文   时间:2014-06-16 11:28:03    阅读次数:199
【HDOJ】1892 See you~
wa了十次,原来变量名写错。二维树状数组。 1 #include 2 #include 3 4 #define MAXN 1002 5 6 int nums[MAXN][MAXN]; 7 8 void swap(int *x, int *y) { 9 int tmp;10 ...
分类:其他好文   时间:2014-06-16 08:34:51    阅读次数:216
HDOJ 1196 Lowest Bit
题目大意是给一个1-100的整数,要求首先转化成2进制,然后从最低位开始数起到不是0的位停止,输出这些位代表队额10进制数 1 #include 2 3 using namespace std; 4 5 int bits[7]={1,2,4,8,16,32,64}; 6 int judge(i...
分类:其他好文   时间:2014-06-16 08:10:21    阅读次数:226
【HDOJ】1930 And Now, a Remainder from Our Sponsor
简单字符串。 1 #include 2 3 #define MAXLEN 160 4 5 char buf[MAXLEN]; 6 int keys[4], parts[4]; 7 8 void getpart(int x) { 9 int i;10 for (i=3; i>=...
分类:其他好文   时间:2014-06-13 15:10:31    阅读次数:242
【HDOJ】1823 Luck and Love
二维线段树。wa了几次,不存在输出-1,而不再是一位小数。 1 #include 2 #include 3 4 #define MAXN 105 5 #define MAXM 1005 6 #define lson l, mid, rtb) ? a:b; 13 } 14 15 i...
分类:其他好文   时间:2014-06-12 10:49:17    阅读次数:204
矩阵操作类
1 #ifndef __MAPLE_MATRIX_H__ 2 #define __MAPLE_MATRIX_H__ 3 4 #include "maple.h" 5 6 typedef struct MATRIX{ 7 union{ 8 ...
分类:其他好文   时间:2014-06-10 16:04:42    阅读次数:159
[LeetCode] Search a 2D Matrix [25]
题目... 二维数组中的查找,这是个简单的题,根据题意可以推出,这个二维数组其实是一个有序的一维数组。解决思路也很容易想到,每次比较每一维最后一个元素,如果该元素比要找的元素小,说明这个行不可能含该元素;如果相等,那就找到了,如果最后一个元素比要找元素大,说明该元素如果出现比在这一行。然后再在这一行中就行查找(可以用顺序,也可二分)。 代码如下:...
分类:其他好文   时间:2014-06-10 14:49:37    阅读次数:233
矩阵操作类
1 #ifndef __MAPLE_MATRIX_H__ 2 #define __MAPLE_MATRIX_H__ 3 4 #include "maple.h" 5 6 typedef struct MATRIX{ 7 union{ 8 ...
分类:其他好文   时间:2014-06-10 10:28:48    阅读次数:310
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!