You are given annxn2D matrix representing an
image.Rotate the image by 90 degrees (clockwise).Follow up:Could you do this
in-place?classSolution{publi...
分类:
其他好文 时间:
2014-06-04 20:25:09
阅读次数:
227
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-04 20:06:52
阅读次数:
256
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-04 19:28:23
阅读次数:
220
bfs+优先队列。wa了N次,才发现可以停留等待楼梯变换方向。 1 #include 2
#include 3 #include 4 #include 5 using namespace std; 6 7 #define MAXNUM 55 8 9
typedef struct node...
分类:
其他好文 时间:
2014-06-03 13:26:06
阅读次数:
274
线段树。 1 #include 2 3 #define maxn 55555 4 5 int
sums[maxn>1;18 build(l, m, rt>1;30 if (des =r)40 return sums[rt];41 42 m =
(l+r)...
分类:
其他好文 时间:
2014-06-03 07:38:20
阅读次数:
219
BFS+优先级队列。 1 #include 2 #include 3 #include 4
#include 5 using namespace std; 6 7 #define MAXNUM 205 8 9 typedef struct
node_st {10 int x, y...
分类:
其他好文 时间:
2014-06-03 06:50:09
阅读次数:
259
二维费用背包。 1 #include 2 #include 3 4 #define mymax(a,
b) (a>b) ? a:b 5 6 int dp[105][1005]; 7 int time[105], val[105]; 8 9 int
main() {10 int ca...
分类:
其他好文 时间:
2014-05-30 06:35:56
阅读次数:
173
1 #include 2 #include 3 4 #define mymax(a, b)
(a>b) ? a:b 5 6 typedef struct { 7 int x, y, c; 8 } rect_st; 9 10 rect_st
rects[15];11 12 int d...
分类:
其他好文 时间:
2014-05-30 04:35:16
阅读次数:
200
Fast Matrix OperationsThere is a matrix
containing at most 106elements divided into r rows and c columns. Each element
has a location (x,y) where 10)2...
分类:
其他好文 时间:
2014-05-30 03:31:23
阅读次数:
516
Rotate ImageYou 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-05-29 23:02:38
阅读次数:
254