
额
GoesOn
这个作者很懒,什么都没留下…
展开
-
Dungeon Master(逃脱大师)-BFS
Dungeon MasterDescriptionYou 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原创 2016-02-21 16:49:41 · 818 阅读 · 0 评论 -
凑算式-蓝桥-全排列
凑算式 B DEFA + --- + ------- = 10 C GHI (如果显示有问题,可以参见【图1.jpg】) 这个算式中A~I代表1~9的数字,不同的字母代表不同的数字。 比如:6+8/3+952/714 就是一种解法,原创 2017-03-23 20:48:34 · 538 阅读 · 0 评论 -
Find The Multiple
DescriptionGiven a positive integer n, write a program to find out a nonzero multiple m of n whose decimal representation contains only the digits 0 and 1. You may assume that n is not greater than原创 2016-02-22 21:00:42 · 634 阅读 · 2 评论 -
二叉树(dfs)
样例输入:5 //下面n行每行有两个数2 3 //第i行的两个数,代表编号为i的节点所连接的两个左右儿子的编号。4 50 0 // 0 表示无0 00 0 样例输出:2 3 #include#include#define inf -1using namespace原创 2016-02-22 19:13:10 · 474 阅读 · 0 评论 -
Lake Counting(dfs)
DescriptionDue to recent rains, water has pooled in various places in Farmer John's field, which is represented by a rectangle of N x M (1 Each square contains either water ('W') or dry land ('.')原创 2016-02-22 19:08:52 · 574 阅读 · 0 评论 -
经典dfs(depth-first search)
DFS主要在于参数的改变;样例输入:n=4 //给定n个数字a={1,2,4,7} //输入n个数据k=15 //目标数字样例输出:No题意:给定的数字在不重复使用的前提下能否达到目标,能输出Yes,否输出No#include#includeusing namesp原创 2016-02-22 19:07:13 · 566 阅读 · 0 评论 -
喝啤酒(预防老年痴呆的深度搜索)
每瓶啤酒2元,2个空酒瓶或4个瓶盖可换1瓶啤酒。10元最多可喝多少瓶啤酒?#include#includeusing namespace std;int dfs(int p, int g, int ans){ if(p < 2 && g < 4) return ans; int ret1 = 0; int ret2 = 0; if(p >= 2) r原创 2016-02-22 18:51:03 · 849 阅读 · 0 评论 -
Oil Deposits
DescriptionThe GeoSurvComp geologic survey company is responsible for detecting underground oil deposits. GeoSurvComp works with one large rectangular region of land at a time, and creates a grid原创 2016-02-22 14:57:48 · 504 阅读 · 0 评论 -
Catch That Cow
DescriptionFarmer 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) on a number line and the cow is at a point原创 2016-02-22 14:55:10 · 492 阅读 · 0 评论 -
迷宫问题
迷宫问题Description定义一个二维数组: 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表示可以走的路,只能横着走或竖着走,不能斜着走,要求编程原创 2016-02-21 21:33:21 · 562 阅读 · 0 评论 -
使用欧拉筛解决素数计算问题
转自: http://www.cnblogs.com/A-S-KirigiriKyoko/articles/6034572.html 我们知道当一个数为素数的时候,它的倍数肯定不是素数。所以我们可以从2开始通过乘积筛掉所有的合数。 将所有合数标记,保证不被重复筛除,时间复杂度为O(n)。public class Main { public static void main...转载 2018-08-01 13:13:50 · 478 阅读 · 0 评论