简单深搜,可以完全暴力,不会超时的。#include#include#includeusing
namespace std;#define MAX(a,b) (a>b?a:b) char maze[10][10];int n, maxn;void
DFS(int step,int count);in...
分类:
Web程序 时间:
2014-06-04 20:43:04
阅读次数:
270
Given two wordsword1andword2, find the minimum
number of steps required to convertword1toword2. (each operation is counted as 1
step.)You have the fol...
分类:
其他好文 时间:
2014-06-04 20:12:15
阅读次数:
199
Given a string S and a string T, find the
minimum window in S which will contain all the characters in T in complexity
O(n).For example,S="ADOBECODEBA...
Random MazeTime Limit: 10000/3000 MS
(Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s):
1114Accepted Submission(s): 387Problem...
分类:
其他好文 时间:
2014-06-04 18:54:28
阅读次数:
284
题目真长。。。。。看了好长时间才看懂。。就是给你一个32位数字和一个最多15个字符的字符串,从字符串中选出5个字符,若满足题中给的那个式子,输出字典序最大的那5个字符,若不满足,输出no
solution。为了解决字典序问题,在输入字符串后,把字符串按从大到小排一下序,搜索一下若满足条件输出即可。贴...
分类:
其他好文 时间:
2014-06-03 13:07:48
阅读次数:
200
显然母函数,有一个地方需要注意。当输入0时,只有一种方法,所以输出1。代码: 1
#include 2 #include 3 #include 4 #include 5 using namespace std; 6 int
c1[255][111], c2[255][111]; 7 main...
分类:
其他好文 时间:
2014-06-03 12:21:39
阅读次数:
242
逆序数的性质。1. 暴力解 1 #include 2 3 #define MAXNUM 5005 4
5 int a[MAXNUM]; 6 7 int main() { 8 int n; 9 int i, j, sum, min;10 11 while
(scanf(...
分类:
其他好文 时间:
2014-05-31 07:50:50
阅读次数:
170
算法入门经典训练指南88页练习::这道题只要把原矩阵扩大4倍,那么其跟最大子矩阵的题目就很类似,把二维转化成一维,求最大的序列和,不过这个序列的长度不能超过n。长度不能超过n?
那这道题又跟hdu 3415HDU 3415 Max Sum of Max-K-sub-sequence (单调队列) 1...
分类:
其他好文 时间:
2014-05-30 18:14:46
阅读次数:
471
Given a strings, partitionssuch that every
substring of the partition is a palindrome.Return the minimum cuts needed for a
palindrome partitioning ofs...
分类:
其他好文 时间:
2014-05-30 15:13:10
阅读次数:
262
Given a triangle, find the minimum path sum
from top to bottom. Each step you may move to adjacent numbers on the row
below.For example, given the fol...
分类:
其他好文 时间:
2014-05-30 14:59:37
阅读次数:
241