不仅仅是DFS,还需要考虑可以走到终点。同时,需要进行预处理。至多封闭点数为起点和终点的非墙壁点的最小值。
1 #include 2 #include 3 #include 4 #include 5 #include 6 using namespace std; 7
8 ...
分类:
其他好文 时间:
2014-05-26 13:29:22
阅读次数:
286
qsort直接排序。 1 #include 2 #include 3 #include 4 5
#define MAXNUM 1000 6 7 typedef struct { 8 int index; 9 double statis;10 }
node_st;11 12 ...
分类:
其他好文 时间:
2014-05-26 10:05:44
阅读次数:
229
【题目】
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?
【题意】
给定一个nXn的二维矩阵,按时钟方向旋转90度,不能使用额外的数据结构
【思路】
从外向内逐层旋转...
分类:
其他好文 时间:
2014-05-26 05:50:25
阅读次数:
266
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Matrix;
import android.graphics.Paint;
im...
分类:
其他好文 时间:
2014-05-26 05:49:01
阅读次数:
284
A Matrix
题意:按照题目中给定的方法,给你一个矩阵,求出变换出该矩阵的字符串
思路:构造问题,在纸上多画几组就能发现,每次必须从上往下找到一条路径,最后输出这些路径,按照开头最大的最晚输出,找的过程中只要不断往下一层找一个大的即可,并且如果一开使有一行是非递增就是错误
代码:
#include
#include
#include
#include
using names...
分类:
其他好文 时间:
2014-05-26 05:24:51
阅读次数:
220
【题目】
Given a matrix of m x n elements (m rows, n columns), return all elements of the matrix in spiral order.
For example,
Given the following matrix:
[
[ 1, 2, 3 ],
[ 4, 5, 6 ],
[ 7, 8, 9 ]
]
You should return [1,2,3,6,9,8,7,4,5].
【题意】
螺旋输出MxN...
分类:
其他好文 时间:
2014-05-24 23:11:02
阅读次数:
279
Young tableaus 是 Introduction_to_algorithms的一 道课后习题, 一度还把我难住了。现在把 python 代码贴出来,供大家参考。
#! /usr/bin/python
""" young tableau
m x n matrix
"""
import sys
class element():
def __ini...
分类:
其他好文 时间:
2014-05-24 21:08:21
阅读次数:
397
print matrix/2d-array in clockwise direction
分类:
其他好文 时间:
2014-05-24 09:54:29
阅读次数:
305
POJ【数论/组合/博弈论】题目列表
POJ【数论/组合/博弈论】题目列表
原来的列表比较水,今天换了一个难一些的列表,重新开始做~
红色的代表已经AC过,蓝色的代表做了但是还没过。这句话貌似在我空间里的每份列表里都有额。
博弈论
POJ 2234 Matches Game
POJ 2975 Nim
POJ 2505 A multiplication game
POJ...
分类:
其他好文 时间:
2014-05-21 11:09:40
阅读次数:
346
Problem Description
A tree is a well-known data structure that is either empty (null, void, nothing) or is a set of one or more nodes connected by directed edges between nodes satisfying the follow...
分类:
其他好文 时间:
2014-05-21 10:55:57
阅读次数:
325