
深度搜索
文章平均质量分 62
杨林峰的笔记
不积硅步,无以至千里;不积小流,无以成江海。
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
京东笔试题2:求括号匹配数目
题目描述:描述有一个合法的字符串,合法是指左括号与右括号全部能配对,现在每次将这个序列第一个左括号删去,在将任意一个右括号删去,每次删去后的序列必须合法,求有多少种方法输入一个合法括号序列。输出方案数。样例输入()()()() (((())))()()样例输出1 24算法思想:这道题惯性思维是使用深度搜索,深度搜索函数有两个参数,输入字符串与标志位,其中标志位用于标志查询的是左括号还是右括号,如原创 2017-09-08 21:50:55 · 1606 阅读 · 0 评论 -
题目1058:部分和问题
题目链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=1058描述给定整数a1、a2、…….an,判断是否可以从中选出若干数,使它们的和恰好为K。输入首先,n和k,n表示数的个数,k表示数的和。 接着一行n个数。 (1<=n<=20,保证不超int范围)输出如果和恰好可以为k,输出“YES”,并按输入顺序依次输出是由哪几个数的和组成,否则“N原创 2017-10-14 19:58:19 · 321 阅读 · 0 评论 -
题目635:Oh, my goddess
题目链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=635描述Shining Knight is the embodiment of justice and he has a very sharp sword can even cleavewall. Many bad guys are dead on his sword.One day, tw原创 2017-10-13 16:05:03 · 284 阅读 · 0 评论 -
题目491:幸运三角形
题目链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=491描述话说有这么一个图形,只有两种符号组成(‘+’或者‘-’),图形的最上层有n个符号,往下个数依次减一,形成倒置的金字塔形状,除第一层外(第一层为所有可能情况),每层形状都由上层决定,相邻的符号相同,则下层的符号为‘+’,反之,为‘-’;如下图所示(n = 3 时的两种情况): 如原创 2017-10-03 11:30:09 · 332 阅读 · 0 评论 -
题目488:素数环
题目链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=488描述有一个整数n,把从1到n的数字无重复的排列成环,且使每相邻两个数(包括首尾)的和都为素数,称为素数环。为了简便起见,我们规定每个素数环都从1开始。例如,下图就是6的一个素数环。 输入有多组测试数据,每组输入一个n(0<n<20),n=0表示输入结束。输出每组第一行输出对应的Case原创 2017-10-02 21:50:28 · 461 阅读 · 0 评论 -
题目483:Nightmare
题目链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=483描述Ignatius had a nightmare last night. He found himself in a labyrinth with a time bomb on him. The labyrinth has an exit, Ignatius should get o原创 2017-10-10 11:03:42 · 242 阅读 · 0 评论 -
题目284:坦克大战
题目链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=284描述Many of us had played the game “Battle city” in our childhood, and some people (like me) even often play it on computer now. What we are dis原创 2017-10-04 22:48:00 · 569 阅读 · 0 评论 -
Leetcode 79:Word Search
题目链接:https://leetcode.com/problems/word-search/description/描述Given a 2D board and a word, find if the word exists in the grid.The word can be constructed from letters of sequentially adjacent cell, whe原创 2017-10-18 11:08:30 · 202 阅读 · 0 评论 -
题目43:24 Point game
题目链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=43描述There is a game which is called 24 Point game. In this game , you will be given some numbers. Your task is to find an expression which have al原创 2017-10-09 13:53:42 · 295 阅读 · 0 评论 -
题目42:一笔画问题
题目链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=42描述zyc从小就比较喜欢玩一些小游戏,其中就包括画一笔画,他想请你帮他写一个程序,判断一个图是否能够用一笔画下来。规定,所有的边都只能画一次,不能重复画。输入第一行只有一个正整数N(N≤10)表示测试数据的组数。 每组测试数据的第一行有两个正整数P,Q(P≤1000,Q≤2000),分别原创 2017-09-28 14:21:05 · 2027 阅读 · 0 评论 -
题目927:The partial sum problem
题目链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=927描述One day,Tom’s girlfriend give him an array A which contains N integers and asked him:Can you choose some integers from the N integers and the原创 2017-10-14 20:20:16 · 209 阅读 · 0 评论