搜索
此间少年_leozp
这个作者很懒,什么都没留下…
展开
-
POJ 2488(dfs+字典序)
poj2488题意: 问能不能不重复地走能遍历所有的棋格,走法按中国象棋马的方法。分析: dfs+字典序输出...我的字典序处理是用的String 来存,每次dfs后将该次有效遍历的地址加到串里面。从(0,0)开始。其他的就是基本的dfs知识~#include #include #include #include #include #define Max 30u原创 2014-09-22 21:35:03 · 911 阅读 · 0 评论 -
zoj3633
ZOj 3633点击打开链接大致题意:给你n个数,m个查询,每个查询给出俩个数a,b,查询从b->a(从右到左)有没有重复出现的数,有的话输出第一个出现的重复的数,否则输出OK;解题思路:我是直接用map查询时,从后往前,map的find()判断是否有重复。#include #include #include #include #include #includ原创 2014-11-01 17:54:55 · 884 阅读 · 0 评论 -
HDU 1312 Red and Black
HDU - 1312Red and BlackTime Limit: 1000MS Memory Limit: 32768KB 64bit IO Format: %I64d & %I64uSubmit StatusDescriptionThere is a rectangular原创 2016-07-12 11:21:16 · 179 阅读 · 0 评论 -
hdu 1258 Sum It Up
Sum It UpTime Limit: 1000MS Memory Limit: 32768KB 64bit IO Format: %I64d & %I64uSubmit StatusDescriptionGiven a specified total t and a list of n integers, find a原创 2016-07-12 11:26:29 · 393 阅读 · 0 评论 -
hdu 1047 Image Perimeters
Image PerimetersTime Limit: 2MS Memory Limit: 65536KB 64bit IO Format: %lld & %lluStatusDescriptionTechnicians in a pathology lab analyze digitized images of sl原创 2016-07-12 11:33:19 · 244 阅读 · 0 评论 -
Leetcode: N-Queens
Leetcode: N-QueensThe n-queens puzzle is the problem of placing n queens on an n×n chessboard such that no two queens attack each other.Given an integer n, return all distinct solutions to t原创 2016-07-23 10:11:17 · 180 阅读 · 0 评论 -
Leetcode: N-Queens II
N-Queen ||Follow up for N-Queens problem.Now, instead outputting board configurations, return the total number of distinct solutions.Subscribe to see which companies asked this q原创 2016-07-23 10:20:03 · 173 阅读 · 0 评论 -
全排列
全排列的应用很广,比如路径全部输出以前一直用递归写的全排列,今天发现可以用C++ STL 实现//递归方法#include#include#includeusing namespace std;char a[10];int n;void fuck(char *b,int k){ if(k>=n-1){ for(int i=0;i<n;i++)原创 2016-06-16 16:04:00 · 257 阅读 · 0 评论 -
Leetcode:Word Search
/** * 跟走迷宫类似,设置一个标记数组,记录下已经走过的点,dfs深搜,如果能搜到word的末尾,return true * */class Solution {public: int dx[4]={1,-1,0,0}; int dy[4]={0,0,1,-1}; int n,m; bool exist(vector>& board, string原创 2016-07-28 22:09:44 · 183 阅读 · 0 评论