Hadoop学习笔记(6) ——重新认识Hadoop 之前,我们把hadoop从下载包部署到编写了helloworld,看到了结果。现是得开始稍微更深入地了解hadoop了。 Hadoop包含了两大功能DFS和MapReduce, DFS可以理解为一个分布式文件系统,存储而已,所以这里暂时就不深入....
分类:
其他好文 时间:
2014-07-30 09:44:03
阅读次数:
344
题意:给一个元素周期表的元素符号(114种),再给一个串,问这个串能否有这些元素符号组成(全为小写)。解法1:动态规划定义:dp[i]表示到 i 这个字符为止,能否有元素周期表里的符号构成。则有转移方程:dp[i] = (dp[i-1]&&f(i-1,1)) || (dp[i-2]&&f(i-2,2...
分类:
其他好文 时间:
2014-07-30 00:47:12
阅读次数:
413
例题:POJ 1915 Knight Moves 骑士遍历问题(跳马问题)在一个m*m的棋盘上,从任意一个给定的位置(sx , sy)出发,为象棋中的马找一条路通过最少的步数到达另一位置(ex ,ey),输出最少所需要的步数。利用bfs求解。当马在位置(x , y)的时候其后继节点(后继选择)是什么...
分类:
其他好文 时间:
2014-07-29 20:37:12
阅读次数:
275
poj1010——邮票问题
DFS
poj1011——Sticks dfs + 剪枝
poj1020——拼蛋糕
poj1054——The Troublesome Frog
poj1062——昂贵的聘礼
poj1077——Eight
poj1084——Square Destroyer
poj1085——Triangle War(博弈,極大極小搜索+alpha_beta剪枝)
po...
分类:
其他好文 时间:
2014-07-29 18:07:12
阅读次数:
294
题解:本来想着用dfs,后来写着写着就成普通的循环了,将起始点0先涂色,然后把和他相邻的其他点涂成另一种颜色,再从下一个点搜索,如果有连线但已经被涂色且和自己颜色一样就可以判断结果是错。
#include
#include
const int N = 200 + 5;
int n, l, G[N][N], vis[N], flag;
void init() {
memset(G, 0...
分类:
其他好文 时间:
2014-07-29 18:02:02
阅读次数:
209
要事先判断结点1能否到达K,否则真的会超时的= =(我一开始不信,感觉应该能正常退出dfs啊,结果真的超时了)我是判断的k是否与其他结点有路,是的话才dfs(数据水,居然过了)#include #include #include #include #include #include #define ...
分类:
其他好文 时间:
2014-07-29 17:39:42
阅读次数:
171
Problem Description
Alice and Bob are playing a game. There are two piles of cards. There are N cards in each pile, and each card has a score. They take turns to pick up the top or bottom card from...
分类:
其他好文 时间:
2014-07-29 15:03:28
阅读次数:
248
Description
We all love recursion! Don't we?
Consider a three-parameter recursive function w(a, b, c):
if a
1
if a > 20 or b > 20 or c > 20, then w(a, b, c) returns:
w(20, 20, 20)
...
分类:
其他好文 时间:
2014-07-29 14:54:08
阅读次数:
278
题目分析:
现在有n个村子,你想要用收买m个国家为你投票,其中收买第i个国家的代价是val[i]。但是有些国家存在从属关系,如果B从属于A国,则收买了A也意味着买通了B,而且这些关系是传递的。问你最小要付出的代价是多少?
这题的难点在于怎么建图,弱菜不会,只能膜拜大神的代码,然后自己捉摸着敲,dfs部分就和一般的树形DP+背包差不多,只是状态的初始化有些变化
建图需要加个...
分类:
其他好文 时间:
2014-07-29 14:38:38
阅读次数:
157
Description
Given two positive integers n and k, you are asked to generate a new integer, say m, by changing some (maybe none) digits of n, such that the following properties holds:
m contains n...
分类:
其他好文 时间:
2014-07-29 14:22:18
阅读次数:
225