随笔分类 -  搜索

摘要: 阅读全文
posted @ 2020-07-23 12:16 _Ackerman 阅读(286) 评论(0) 推荐(0)
摘要: 阅读全文
posted @ 2020-06-22 16:28 _Ackerman 阅读(240) 评论(0) 推荐(0)
摘要: 阅读全文
posted @ 2020-03-23 19:52 _Ackerman 阅读(232) 评论(0) 推荐(0)
摘要: 阅读全文
posted @ 2020-03-06 22:53 _Ackerman 阅读(277) 评论(0) 推荐(0)
摘要: 阅读全文
posted @ 2020-03-06 22:51 _Ackerman 阅读(364) 评论(0) 推荐(0)
摘要: 阅读全文
posted @ 2020-03-06 22:49 _Ackerman 阅读(225) 评论(0) 推荐(0)
摘要:题目链接:https://www.luogu.org/problem/P1443 思路: 这题主要是这🐎可以走的地方太多了,需要考虑清楚每一种情况,方向数组不要有遗漏 1 #include <math.h> 2 #include <stdio.h> 3 #include <stdlib.h> 4 阅读全文
posted @ 2019-11-14 21:06 _Ackerman 阅读(301) 评论(1) 推荐(0)
摘要:题目链接:https://www.luogu.org/problem/P1126 思路: 首先我们需要把题意的图给转化一下,变成下面这种 然后我们再定义一个方向: 4代表 "N" 3代表"S" 2代表"W" 1代表"E" 于是,开始写BFS 用队列存储每一个格点的信息,然后起点入队,每次从队首取出一 阅读全文
posted @ 2019-11-14 21:02 _Ackerman 阅读(238) 评论(0) 推荐(0)
摘要:题目链接:https://www.luogu.org/problem/P1141 这题目就尼玛的傻逼题 (如果出现a-b-c的路可以走,那么从b出发可达到的最多的地点和从a出发是一样的!) 思路: 根据题目的要求,我把此时出发的点一直到最后走过最多点时的终点全部记录下来,那么无论如何从这些点出发走过 阅读全文
posted @ 2019-11-14 20:56 _Ackerman 阅读(386) 评论(0) 推荐(0)
摘要:题目链接:https://www.luogu.org/problem/P1032 思路: 采用BFS 我们遍历字符串a的每个字符,判断当前字符串i位置之后可不可以替换,如果可以替换,我们就把替换后的字符串 a' 放入队列。 如果出现的我们想要的字符串,根据BFS的性质,那么就直接记录此时的步数。 1 阅读全文
posted @ 2019-11-14 20:46 _Ackerman 阅读(225) 评论(0) 推荐(0)
摘要:题目链接:http://codeforces.com/problemset/problem/1072/B 题意: 给出长度为n-1的两个数组a和b,要求找出一个长度为n的数组t,使得t[i]|t[i+1]=a[i] && t[i]&t[i+1]=b[i],问是否存在这样的数组t 第一行输入一个n ( 阅读全文
posted @ 2019-08-18 09:35 _Ackerman 阅读(259) 评论(0) 推荐(0)
摘要:题目链接:http://codeforces.com/problemset/problem/9/C 题意: 输入n,输出1-n的自然数中各数位只包含0和1的数的个数。 思路: 不难知道1,10,11,100 这种是满足要求的。那么如何去求呢? 直接根据1,去找10,11 再根据10,去找100,10 阅读全文
posted @ 2019-08-16 19:56 _Ackerman 阅读(325) 评论(0) 推荐(0)
摘要:Problem Description Given a specified total t and a list of n integers, find all distinct sums using numbers from the list that add up to t. For examp 阅读全文
posted @ 2019-07-21 19:30 _Ackerman 阅读(343) 评论(0) 推荐(0)
摘要:Suppose that we have a square city with straight streets. A map of a city is a square board with n rows and n columns, each representing a street or a 阅读全文
posted @ 2019-07-21 16:24 _Ackerman 阅读(280) 评论(0) 推荐(0)
摘要:Problem Description A robot has been programmed to follow the instructions in its path. Instructions for the next direction the robot is to move are l 阅读全文
posted @ 2019-07-21 14:31 _Ackerman 阅读(351) 评论(0) 推荐(0)
摘要:Problem Description The doggie found a bone in an ancient maze, which fascinated him a lot. However, when he picked it up, the maze began to shake, an 阅读全文
posted @ 2019-07-20 21:56 _Ackerman 阅读(316) 评论(0) 推荐(0)
摘要:相信大家都知道什么是全排列,但是今天的全排列比你想象中的难一点。我们要找的是全排列中,排列结果互不相同的个数。比如:aab 的全排列就只有三种,那就是aab,baa,aba。 思路: 这道题的思路其实挺简单的,就是dfs去搜索就可以了。 但是有一个问题就是 如何去防止重复呢? 先想一下简化的问题吧, 阅读全文
posted @ 2019-07-20 17:52 _Ackerman 阅读(918) 评论(0) 推荐(0)
摘要:用 0,1,2,3 \cdots 70,1,2,3⋯7 这 88 个数组成的所有整数中,质数有多少个(每个数字必须用到且只能用一次)。 提示:以 00 开始的数字是非法数字。 阅读全文
posted @ 2019-07-20 17:18 _Ackerman 阅读(293) 评论(0) 推荐(0)
摘要:题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1427 思路: 这道题的难点在于你先进行哪几个数的运算。而不是简单的先处理第一个,再处理第二个,再处理第三个,最后处理第四个。 具体的还是看代码的实现吧: 阅读全文
posted @ 2019-07-14 23:55 _Ackerman 阅读(450) 评论(0) 推荐(0)
摘要:题目链接:http://poj.org/problem?id=1979 题目大意: 有一个长方形的房间,上面铺着正方形的瓷砖。每块瓷砖都是红色或黑色的。一个男人站在一块黑色的瓷砖上。从一个瓦片,他可以移动到四个相邻瓦片中的一个。但是他不能在红瓦上移动,他只能在黑瓦上移动。 编写一个程序,通过重复上面 阅读全文
posted @ 2019-07-12 11:36 _Ackerman 阅读(342) 评论(0) 推荐(0)