上一页 1 2 3 4 5 6 7 ··· 12 下一页
摘要: 算法:BFS Joe works in a maze. Unfortunately, portions of the maze have caught on fire, and the owner of the maze neglected to create a fire escape pla... 阅读全文
posted @ 2016-01-03 18:12 (慎独) 阅读(184) 评论(0) 推荐(0) 编辑
摘要: 算法:广搜(BFS); Description 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 ma... 阅读全文
posted @ 2016-01-03 16:41 (慎独) 阅读(231) 评论(0) 推荐(0) 编辑
摘要: 算法:BFS 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,000) ... 阅读全文
posted @ 2016-01-03 13:25 (慎独) 阅读(155) 评论(0) 推荐(0) 编辑
摘要: 算法:BFS 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... 阅读全文
posted @ 2016-01-03 12:24 (慎独) 阅读(175) 评论(0) 推荐(0) 编辑
摘要: 算法:深搜(水题); Given a positive integer n, write a program to find out a nonzero multiple m of n whose decimal representation contains only the digits 0... 阅读全文
posted @ 2016-01-03 11:02 (慎独) 阅读(493) 评论(0) 推荐(0) 编辑
摘要: 算法:广搜; Description Pass a year learning in Hangzhou, yifenfei arrival hometown Ningbo at finally. Leave Ningbo one year, yifenfei have many people t... 阅读全文
posted @ 2016-01-02 20:40 (慎独) 阅读(187) 评论(0) 推荐(0) 编辑
摘要: 算法:简单搜索 在一个给定形状的棋盘(形状可能是不规则的)上面摆放棋子,棋子没有区别。要求摆放时任意的两个棋子不能放在棋盘中的同一行或者同一列,请编程求解对于给定形状和大小的棋盘,摆放k个棋子的所有可行的摆放方案C。 Input 输入含有多组测试数据。 每组数据的第一行是两个正整数,n k,用... 阅读全文
posted @ 2016-01-01 14:04 (慎独) 阅读(165) 评论(0) 推荐(0) 编辑
摘要: 算法:搜索(DFS) 简单的深搜;用一个b[]存放最短的路径下标,一个c[]存放每次搜索的下标;最后比较下路径是否更短,如果是,更新b[] 定义一个二维数组: int maze[5][5] = { 0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0... 阅读全文
posted @ 2015-12-31 12:03 (慎独) 阅读(152) 评论(0) 推荐(0) 编辑
摘要: 算法:搜索 描述 有一个整数n,把从1到n的数字无重复的排列成环,且使每相邻两个数(包括首尾)的和都为素数,称为素数环。 为了简便起见,我们规定每个素数环都从1开始。例如,下图就是6的一个素数环。 输入有多组测试数据,每组输入一个n(0#include #include #includ... 阅读全文
posted @ 2015-12-29 11:02 (慎独) 阅读(190) 评论(0) 推荐(0) 编辑
摘要: 算法:搜索(深度优先搜索) 描述 这有一个迷宫,有0~8行和0~8列: 1,1,1,1,1,1,1,1,1 1,0,0,1,0,0,1,0,1 1,0,0,1,1,0,0,0,1 1,0,1,0,1,1,0,1,1 1,0,0,0,0,1,0,0,1 1,1,0,1,0,1,0,0,1 1,... 阅读全文
posted @ 2015-12-29 10:19 (慎独) 阅读(311) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 ··· 12 下一页