![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
搜索
Kefault
这个作者很懒,什么都没留下…
展开
-
UVA 539 The Settlers of Catan
Within Settlers of Catan, the 1995 German game of the year, players attempt to dominate an island by building roads, settlements and cities across its uncharted wilderness. You are employed by a soft原创 2013-08-07 14:45:11 · 746 阅读 · 0 评论 -
hdu 5167-Fibonacci
题目及代码:这道题目的意思是 给定一个数n,问这个数n是否能由斐波那契数列中的数的乘积组合而成。 首先想到一定会要先打表把所有的斐波那契数求出来,然后直接dfs就ok了。做题的时候很犹豫这样搜索到底行不行,总感觉会超时,结果却过了。 #include #include #include #include using namespace std; typ原创 2015-03-11 19:37:29 · 499 阅读 · 0 评论 -
hdu 5012 Dice
Dice Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 440 Accepted Submission(s): 259 Problem Description There are 2 special dic原创 2014-09-15 21:12:36 · 1059 阅读 · 0 评论 -
UVa 10763 - Foreign Exchange
Description Your non-profit organization (iCORE - international Confederation of Revolver Enthusiasts) coordinates a very successful foreign student exchange program. Over the last few years, d原创 2013-08-14 18:15:47 · 876 阅读 · 0 评论 -
八皇后问题
Problem description: 八皇后问题,是一个古老而著名的问题,是回溯算法的典型例题。该问题是十九世纪著名的数学家高斯1850年提出:在8X8格的国际象棋上摆放八个皇后,使其不能互相攻击,即任意两个皇后都不能处于同一行、同一列或同一斜线上,问有多少种摆法。 高斯认为有76种方案。1854年在柏林的象棋杂志上不同的作者发表了40种不同的解,后来有人用图论原创 2013-08-13 16:47:46 · 893 阅读 · 0 评论 -
素数环(回溯)
Problem description: 输入正整数n,把整数1,2,3,.....,n组成一个环,使得相邻的两个整数和为素数。输出时从整数1开始逆时针排序。同一个环恰好输出一次。n小于等于16。 代码: #include #include #include #include using namespace std; int n,c[1000],vi原创 2013-08-13 18:48:03 · 978 阅读 · 0 评论 -
poj 1564 Sum It Up
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 example, if t = 4, n = 6, and the list is [4, 3, 2, 2, 1, 1],原创 2013-08-17 18:34:57 · 1250 阅读 · 0 评论 -
hdu 4771 Stealing Harry Potter's Precious
题目:给出一个二维图,以及一个起点,m个中间点,求出从起点出发,到达每个中间的最小步数。 思路:因为图的大小最大是100*100,所以要使用bfs求出其中每两个点之间的最小距离。然后根据这些步数,建立一个新的图,使用dfs求出最佳步数。 代码: #include #include #include #include #define INF 100000000 using namesp原创 2014-06-02 16:14:39 · 1055 阅读 · 0 评论 -
nefu 627 剪纸游戏
题目:给定一个n*m大的纸张,上面表明了每块上的字母,在其背后给定了对应位置的字母的value,在最后给出需要剪出来的剪纸的字母序列。 方法:暴力搜索。 代码: #include #include #include #include using namespace std; char map[502][502]; int Map[502][502]; int vis[502][502原创 2014-05-02 14:36:14 · 1138 阅读 · 0 评论 -
hdu 1016 Prime Ring Problem
Problem Description A ring is compose of n circles as shown in diagram. Put natural number 1, 2, ..., n into each circle separately, and the sum of numbers in two adjacent circles should be a prime.原创 2013-11-15 15:00:34 · 820 阅读 · 0 评论 -
hdu 1253 胜利大逃亡
Problem Description Ignatius被魔王抓走了,有一天魔王出差去了,这可是Ignatius逃亡的好机会. 魔王住在一个城堡里,城堡是一个A*B*C的立方体,可以被表示成A个B*C的矩阵,刚开始Ignatius被关在(0,0,0)的位置,离开城堡的门在(A-1,B-1,C-1)的位置,现在知道魔王将在T分钟后回到城堡,Ignatius每分钟能从一个坐标走到相邻的六个原创 2013-09-20 13:51:27 · 1169 阅读 · 0 评论 -
hdu 1241 Oil Deposits
Problem Description The 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原创 2013-08-08 16:35:08 · 666 阅读 · 0 评论 -
hdu 5179-beautiful number
题目:给定一个区间的两个区间端点l和r,问在l和r之间有多少满足下列情况的数字---这个数字应该满足前一位是后一位的倍数。 分析:这是一个经典的数位DP的题目,我们可以把区间求和转化成两个区间的减法,即S[1,r]-S[1,l-1]就是我们求得的答案。 那么问题就转化成了求1-n之间满足情况的数的个数,那么我们就要使用dp[i][j]求得数字长度为i,首数字为j的满足情况的数原创 2015-03-10 18:44:58 · 795 阅读 · 0 评论