jewels专题

HDU-1044 Collect More Jewels BFS + DFS

/* http://acm.hdu.edu.cn/showproblem.php?pid=1044一道将BFS和DFS联合起来做的题目。题意:有一个n*m的castle?然后里面某些点放了些宝藏,每个宝藏都是具有不同的自身价值,现在一个人在入口处,剩下t时间,问怎么样才能在给定的时间下获得最大的宝藏价值(就是尽量贪婪)大概的思路:对整个城堡做bfs,bfs求得某个点(其实包含3种,入口。

LeetCode-Jewels_and_Stones

题目: You're given strings J representing the types of stones that are jewels, and S representing the stones you have.  Each character in Sis a type of stone you have.  You want to know how many of t

hdu 1044 Collect More Jewels(BFS+DFS)

原题链接: http://acm.hdu.edu.cn/showproblem.php?pid=1044 题目大意: T组测试数据 W宽H高L时间限制M多少个宝石 m1……mM   宝石的价值 W*H矩阵 在限制时间内,从‘@’到‘<'且能获得的最大价值。 思路: BFS: 求出任意两点之间的最短距离(含’@‘与’<')。 DFS: 求最大价值。