![](https://img-blog.csdnimg.cn/20201014180756738.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
广搜
文章平均质量分 78
尉水风
这个作者很懒,什么都没留下…
展开
-
Find The Multiple
英语是硬伤~人工翻译:描述:给出一个正整数n,编写一个能够找到n的非零倍数m的程序,m是十进制且每位只能是0或1,你可以确定n不大于200而且存在相应的m不大于100个十进制位输入:多组数据输入,每行都包含一个数n(1输出:对于每个n的值输出一个符合条件的m(单独占一行),m的十进制位数一定不能超过100位,如果对于n有多组符合条件的值只输出它们其中的一个其实这道题原创 2017-07-29 16:15:47 · 293 阅读 · 0 评论 -
蓝桥-PREV-44 青蛙跳杯子
历届试题 青蛙跳杯子 问题描述 X星球的流行宠物是青蛙,一般有两种颜色:白色和黑色。 X星球的居民喜欢把它们放在一排茶杯里,这样可以观察它们跳来跳去。 如下图,有一排杯子,左边的一个是空着的,右边的杯子,每个里边有一只青蛙。 *WWWBBB 其中,W字母表示白色青蛙,B表示黑色青蛙,*表示空杯子。 X星的青蛙很有些癖好,它们只做3个动作之一: 1. 跳到相邻的空杯子里。 2...原创 2018-03-10 11:31:01 · 1080 阅读 · 0 评论 -
十四大师
在很久很久以前,有一位大师级程序员,实力高强,深不可测,代码能力无人能及。从来没有人听说过他的真名,只知道他在完成一段代码后,总会跟上一行注释“十四出品,必属精品”,于是他在编程江湖上便有了绰号“十四”。 然而,十四大师并不满足于现有的一切,他想要让自己的实力有更进一步的提升。为此,他专程前往二次元世界修行。 二次元旅程归来的十四大师学习了新的技能——闪现。 在一条既定的直线道路原创 2017-09-01 20:51:26 · 615 阅读 · 0 评论 -
Ostap and Grasshopper
On the way to Rio de Janeiro Ostap kills time playing with a grasshopper he took with him in a special box. Ostap builds a line of length n such that some cells of this line are empty and some contain原创 2017-09-04 18:56:13 · 305 阅读 · 0 评论 -
非常可乐
这道题目要用广搜,三个杯子互相倒水总共六种状态,注意剪枝条件的判定(总量为奇数时无法平分,杯子为空时无法倒出水,杯子为满时无法倒入水)大家一定觉的运动以后喝可乐是一件很惬意的事情,但是seeyou却不这么认为。因为每次当seeyou买了可乐以后,阿牛就要求和seeyou一起分享这一瓶可乐,而且一定要喝的和seeyou一样多。但seeyou的手中只有两个杯子,它们的容量分别是N 毫升和M原创 2017-07-28 21:16:14 · 266 阅读 · 0 评论 -
Find a way
这道题目需要用到两次广搜,分别找出两个人到各个kfc花费的时间(有的人可能无法到达所有的kfc,而且只要不是#就都能走)Pass a year learning in Hangzhou, yifenfei arrival hometown Ningbo at finally. Leave Ningbo one year, yifenfei have many people to mee原创 2017-07-28 18:33:32 · 256 阅读 · 0 评论 -
Fire Game
这道题需要对只有一块草地的情况特别判断一下Fat brother and Maze are playing a kind of special (hentai) game on an N*M board (N rows, M columns). At the beginning, each grid of this board is consisting of grass or j原创 2017-07-28 10:19:38 · 314 阅读 · 0 评论 -
Pots
这道题需要用到广搜对那三种(其实是六种操作)进行判断,最后用递归输出You are given two pots, having the volume of A and B liters respectively. The following operations can be performed:FILL(i) fill the pot i (1 ≤ i ≤原创 2017-07-27 10:56:36 · 327 阅读 · 0 评论 -
Fire!
这道题目需要进行两次广搜,一次是对火的,一次是对Joe的,只要保证Joe在到达那点时火灾没有蔓延到,同时要注意火灾可能有多处(可能也存在没有火灾的情况),在写代码的时候只要Joe到达边界即可判定他成功逃脱,而不是他越过边界后才停止循环,我的两次Runtime Error就是这么造成的Problem B: Fire!Joe works in a maze. Unfortunately原创 2017-07-26 21:30:19 · 332 阅读 · 0 评论 -
Dungeon Master
广搜只不过这道题目需要搜索六个方向,即:上、下、左、右、上一层、下一层You are trapped in a 3D dungeon and need to find the quickest way out! The dungeon is composed of unit cubes which may or may not be filled with rock. It tak原创 2017-07-26 19:02:45 · 219 阅读 · 0 评论 -
Prime Path
这道题目需要用到广搜,将既是素数又只与队首元素只相差一位的数字加入队列,要注意剪枝防止对一个数字的重复计算The ministers of the cabinet were quite upset by the message from the Chief of Security stating that they would all have to change the four-d原创 2017-07-26 16:54:16 · 278 阅读 · 0 评论 -
迷宫问题
广搜记录一下该节点的前一个节点就行定义一个二维数组: int maze[5][5] = { 0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0,};它表示一个迷宫,其中的1表示墙壁,0表示可以走的路,只能横着走或竖着走,不能斜着走,要求编程序找出从左上原创 2017-07-25 16:22:59 · 255 阅读 · 0 评论 -
Catch That Cow
这道题目需要广搜+剪枝,如果不剪枝的话用队列就会超内存,但是如果用数组模拟的话虽然不会超内存但会浪费很多的时间Farmer John has been informed of the location of a fugitive cow and wants to catch her immediately. He starts at a point N (0 ≤ N ≤ 100,0原创 2017-07-24 19:11:02 · 392 阅读 · 0 评论 -
Battle City
这道题目需要优先队列+广搜来求解至于不能直接用广搜,我想应该是由于其中要经过砖墙时时间消耗为2,这使得广搜中的最优解难以得到如下图:颜色的深浅代表加入的先后,第一次加入B E,第二次加入E B,第三次加入E,第四次加入T那么得到Y B B E T的路径而最优路径是Y E B E T,这就需要使用优先队列 Many of us had played the game "B...原创 2017-07-21 18:53:09 · 767 阅读 · 0 评论 -
The Tag Game
a要追赶b,b尽量不让a追上,可以通过深搜或广搜获得a,b分别到每一个节点的的时间,只要b到达某点的时间小于a到该点的时间就表明b能优先于a到达该点,此后只要找一个最大值即可Alice got tired of playing the tag game by the usual rules so she offered Bob a little modification to it.原创 2017-07-30 17:55:56 · 290 阅读 · 0 评论 -
1004 Counting Leaves
1004 Counting Leaves (30 分)A family hierarchy is usually presented by a pedigree tree. Your job is to count those family members who have no child.Input Specification:Each input file contains on...原创 2018-09-21 19:00:10 · 319 阅读 · 0 评论